/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #e8e8ea;
  background: #1e2025;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: #e8e8ea;
}
.hidden { display: none !important; }
.mobile-only { display: none; }
@media (max-width: 768px) { .mobile-only { display: inline-flex; } }

/* ============ 主题色 ============ */
:root {
  --primary: #4f8cff;
  --primary-hover: #6ba0ff;
  --success: #2dd4bf;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #6366f1;

  --bg-base: #1e2025;
  --bg-card: #2a2d35;
  --bg-card-hover: #33373f;
  --bg-input: #1e2025;
  --bg-elev: #2f3340;

  --border: #3a3f4d;
  --border-light: #4a4f5c;

  --text-primary: #e8e8ea;
  --text-secondary: #a8acb6;
  --text-muted: #6b6f7a;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ============ 登录页 ============ */
.login-page {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1a1d24 0%, #2a2f3a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
/* 登录页容器：卡片 + 备案号，整体居中 */
.login-wrap {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center;
}
/* ICP 备案号（工信部要求：首页底部居中，可点击跳转） */
.icp-footer {
  margin-top: 18px;
  font-size: 12px; line-height: 1.6;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
}
.icp-footer a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color .15s;
}
.icp-footer a:hover {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
}
.login-header { text-align: center; margin-bottom: 28px; }
.brand-logo {
  font-size: 24px; font-weight: 700;
  background: linear-gradient(135deg, #4f8cff, #2dd4bf);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-sub { color: var(--text-secondary); margin-top: 6px; font-size: 13px; }
.login-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.login-hint code {
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

/* ============ 表单 ============ */
.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-field-row { grid-template-columns: 1fr; } }
.form-field-row > div { margin-bottom: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid .form-field.full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
  user-select: none;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #f55f5f; }
.btn-success { background: var(--success); color: #1a1d24; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-card); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-link {
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
  border: none;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { background: var(--bg-card); }

/* ============ 应用布局 ============ */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name {
  color: var(--text-secondary);
  font-size: 13px;
}
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ============ 侧边栏 ============ */
.sidebar {
  width: 200px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  flex-shrink: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all .15s;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary);
  color: white;
}
.nav-icon {
  font-size: 14px;
  width: 18px;
  display: inline-block;
  text-align: center;
}
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: -220px;
    width: 220px;
    z-index: 100;
    transition: left .25s;
  }
  .sidebar.open { left: 0; }
}

/* ============ 主内容区 ============ */
.main-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-width: 0;
}
@media (max-width: 768px) {
  .main-content { padding: 14px; }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============ 仪表盘 ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.stat-card .label {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-card .extra {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.stat-card.primary { border-left: 3px solid var(--primary); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.danger { border-left: 3px solid var(--danger); }

.grid-2 {  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.kpi-row {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}
.mini-kpi {
  flex: 1;
  padding: 14px 12px;
  border-radius: 10px;
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border-tertiary);
  text-align: center;
}
.mini-kpi .num {
  font-size: 20px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.2;
}
.mini-kpi .label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bar-label { width: 90px; font-size: 13px; color: var(--text-secondary); }
.bar-track {
  flex: 1;
  height: 18px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #6ba0ff);
  border-radius: 4px;
  transition: width .4s;
}
.bar-value { font-size: 13px; min-width: 32px; text-align: right; }

/* ============ 表格 ============ */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th {
  background: var(--bg-elev);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table .actions { white-space: nowrap; }
.data-table .empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ============ 一次性业务（增值）：紧凑固定列宽 ============ */
/* 列宽由 <colgroup> 逐列给定（合计 1226px）。注意：table-layout:fixed 必须配一个明确的
   width 才生效（width:auto 时 Chrome 仍按内容自动分配列宽，长公司名会把表撑到 1600+）。 */
.data-table.ot-table {
  table-layout: fixed;
  width: 1226px;
}
.data-table.ot-table th,
.data-table.ot-table td {
  padding: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 序号列：灰色、等宽数字、居中 */
.data-table.ot-table .col-no {
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.data-table.ot-table thead th.col-no { color: var(--text-secondary); }
/* 金额列右对齐，位数对齐好读 */
.data-table.ot-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table.ot-table .cell-clip { cursor: default; }
/* 操作列绝不能被截断：三个按钮约需 154px（每按钮 2 字 + 左右内边距 16px），
   宁可溢出可见，也不能让「删除」被省略号吃掉（2026-11-16 踩过） */
.data-table.ot-table .actions {
  overflow: visible;
  white-space: nowrap;
}

.text-truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ 筛选条 ============ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.filter-bar input,
.filter-bar select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  outline: none;
}
.filter-bar input { min-width: 180px; }
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--primary); }

/* ============ 标签 / 状态徽章 ============ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-elev);
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 2px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.badge-primary { background: rgba(79,140,255,.18); color: #6ba0ff; }
.badge-success { background: rgba(45,212,191,.18); color: #2dd4bf; }
.badge-warning { background: rgba(245,158,11,.18); color: #f59e0b; }
.badge-danger { background: rgba(239,68,68,.18); color: #ef4444; }
.badge-secondary { background: var(--bg-elev); color: var(--text-secondary); }
.badge-info { background: rgba(99,102,241,.18); color: #818cf8; }

.priority-low { background: rgba(168,172,182,.18); color: var(--text-secondary); }
.priority-中 { background: rgba(79,140,255,.18); color: #6ba0ff; }
.priority-高 { background: rgba(239,68,68,.18); color: #ef4444; }

/* ============ 任务看板 ============ */
.task-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.task-tab {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.task-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 200px;
}
.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-header .title {
  font-size: 13px;
  font-weight: 600;
}
.kanban-col-header .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elev);
  padding: 2px 8px;
  border-radius: 10px;
}
.task-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
}
.task-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.task-card.overdue { border-left: 3px solid var(--danger); }
.task-card .t-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.task-card .t-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.task-card .t-meta span { margin-right: 8px; }
.task-card .due-overdue { color: var(--danger); font-weight: 600; }

/* ============ 模态框 ============ */
.modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 2000;
  font-size: 13px;
  max-width: 90vw;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* ============ 详情页 ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
}
.detail-item .label {
  width: 90px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.detail-item .value {
  flex: 1;
  color: var(--text-primary);
  word-break: break-word;
}

/* ============ 错误 / 提示 ============ */
.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 8px;
  min-height: 16px;
}

/* ============ 工具 ============ */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.checkbox-list input { cursor: pointer; }

.perm-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-input);
}
.perm-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
@media (max-width: 600px) { .perm-grid { grid-template-columns: 1fr; } }
.perm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

/* 详情信息块 */
.section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 8px; opacity: .5; }

/* 导入结果 */
.import-result {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  font-size: 13px;
}
.import-result .item { display: flex; gap: 8px; margin-bottom: 4px; }
.import-result .label { width: 90px; color: var(--text-secondary); }

/* ============ 客户表格：列宽 / 筛选 / 列设置 ============ */
.data-table.cust-table {
  table-layout: fixed;
  width: auto;
  min-width: 100%;
}
.data-table.cust-table .cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table.cust-table .col-num { text-align: right; }
.data-table.cust-table .col-center { text-align: center; }

/* 序号列：最左固定宽度，等宽数字，不参与「列设置」 */
.data-table.cust-table .col-no {
  width: 4em;
  min-width: 4em;
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.data-table.cust-table thead th.col-no { color: var(--text-secondary); }
.data-table.cust-table .filter-row th.col-no { padding: 6px 8px; }

/* 筛选行（随内容滚动，不吸顶，避免与表头重叠） */
.data-table.cust-table .filter-row th {
  position: static;
  padding: 6px 8px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.data-table.cust-table .filter-row input,
.data-table.cust-table .filter-row select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 7px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}
.data-table.cust-table .filter-row input:focus,
.data-table.cust-table .filter-row select:focus { border-color: var(--primary); }
.data-table.cust-table .filter-row input::placeholder { color: var(--text-muted); }

/* 列设置弹窗 */
.col-set-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 52vh;
  overflow-y: auto;
}
.col-set-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.col-set-item.dragging { opacity: .45; }
.col-set-item.drag-over { border-color: var(--primary); background: var(--bg-card-hover); }
.col-set-item .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  font-size: 15px;
}
.col-set-item .col-label { flex: 1; font-size: 13px; color: var(--text-primary); }
.col-set-item input[type="checkbox"] { cursor: pointer; width: 15px; height: 15px; }
.col-set-item .col-move { display: flex; gap: 4px; }
.col-set-item .col-move button {
  width: 24px; height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.col-set-item .col-move button:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ============ 客户表格：分页条 ============ */
/* 从客户详情返回列表时，定位行的高亮提示 */
@keyframes rowFlash {
  0%   { background-color: rgba(255, 193, 7, .50); }
  70%  { background-color: rgba(255, 193, 7, .35); }
  100% { background-color: transparent; }
}
.data-table tr.row-flash > td { animation: rowFlash 2.4s ease-out; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 4px 0;
}
.pagination-bar .page-size-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
}
.pagination-bar .page-size-select:focus { border-color: var(--primary); }
.pagination-bar .page-info {
  color: var(--text-secondary);
  font-size: 13px;
}
.pagination-bar .page-total {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 600px) {
  .pagination-bar { justify-content: center; }
}

/* ============ 客户表格：合计行 ============ */
.data-table.cust-table tfoot td {
  background: var(--bg-elev);
  border-bottom: none;
  border-top: 2px solid var(--border);
  font-weight: 600;
}
.data-table.cust-table tfoot .total-cell { padding: 10px 12px; }
.data-table.cust-table tfoot .total-label {
  color: var(--text-primary);
  text-align: left;
}

/* ============ 表单：自动计算提示 ============ */
.auto-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}
.auto-hint.manual { color: var(--warning); }
input[readonly] {
  background: var(--bg-elev) !important;
  color: var(--text-secondary) !important;
  cursor: not-allowed;
}

/* ============ 表单：附件（合同 / 请款书） ============ */
.attach-area {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-elev);
  transition: border-color .2s;
}
.attach-area.dragover { border-color: var(--primary); background: var(--bg-card); }
.attach-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.attach-toolbar .attach-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.attach-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.attach-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  font-size: 13px;
}
.attach-list li.att-group {
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px 0;
}
.attach-list .att-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.attach-list .att-size {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.attach-list .att-dl {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.attach-list .att-dl:hover { text-decoration: underline; }
.attach-list .att-del {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============ 客户合同管理：手风琴菜单 / 状态徽章 / 终止横幅 / 状态日志 ============ */

/* 警告色按钮（结束服务） */
.btn-warning { background: var(--warning); color: #1a1d24; }
.btn-warning:hover { background: #fbbf24; }

/* 复选框行 */
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; }

/* === 手风琴侧边栏 === */
.nav-group { display: block; }
.nav-children { display: none; padding: 2px 0 4px 0; }
.nav-group.open > .nav-children { display: block; }
.nav-toggle {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform .2s;
}
.nav-group.open > .nav-parent .nav-toggle { transform: rotate(-180deg); }
.nav-parent { cursor: pointer; }
.nav-child {
  padding-left: 28px !important;
  font-size: 13px;
  color: var(--text-secondary);
}
.nav-child.active { color: var(--text-primary); }

/* === 三级菜单（代理协议分配名单 → 升元 / 分公司 / 未分配）=== */
.nav-parent-3 {
  padding-left: 28px !important;
  font-size: 13px;
  color: var(--text-secondary);
}
.nav-child-3 {
  padding-left: 46px !important;
  font-size: 12.5px;
}
.nav-child-3 .nav-status-dot { width: 6px; height: 6px; opacity: .7; }

/* 页面副标题（如：代账合同管理 · 升元 / 税务代理协议） */
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.nav-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot-active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot-terminated { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot-info { background: var(--info); box-shadow: 0 0 6px var(--info); }

/* === 状态徽章（详情页标题旁） === */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.status-badge.active { background: rgba(45, 212, 191, 0.15); color: var(--success); }
.status-badge.terminated { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* === 终止红横幅（详情页） === */
.terminated-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.terminated-banner .banner-icon {
  font-size: 24px;
  line-height: 1;
  color: var(--danger);
}
.terminated-banner .banner-title {
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 6px;
}
.terminated-banner .banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.terminated-banner .banner-meta strong { color: var(--text-primary); }
.terminated-banner .banner-note {
  flex-basis: 100%;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(239, 68, 68, 0.25);
  font-size: 12px;
  color: var(--text-muted);
}

/* === 续费提示条（待生效续费单，2026-11-18） === */
.renewal-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0.04));
  border: 1px solid rgba(59, 130, 246, 0.35);
  flex-wrap: wrap;
}
.renewal-banner-icon { font-size: 22px; line-height: 1; }
.renewal-banner-body { flex: 1; min-width: 260px; }
.renewal-banner-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.renewal-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.renewal-banner-meta strong { color: var(--text-primary); }
.renewal-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* === 续费记录 → 该期合同详情弹窗（2026-11-18） === */
.renewal-contract .rc-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin: -4px 0 14px;
  line-height: 1.6;
}
.renewal-contract .rc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 6px;
}
.renewal-contract .rc-stat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.renewal-contract .rc-stat .k { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.renewal-contract .rc-stat .v { font-size: 17px; font-weight: 600; }
.renewal-contract .rc-stat .v.rc-small { font-size: 13.5px; font-weight: 500; }
.renewal-contract .rc-block-h {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 18px 0 8px;
  padding-left: 9px;
  border-left: 3px solid var(--primary);
  line-height: 1.2;
}
.renewal-contract .rc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
}
.renewal-contract .rc-grid .detail-item {
  padding: 5px 0;
  border-bottom: 1px dashed rgba(58, 63, 77, .65);
}
.renewal-contract .rc-remark {
  display: flex;
  gap: 8px;
  padding: 8px 0 0;
  font-size: 14px;
}
.renewal-contract .rc-remark .label {
  width: 90px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.renewal-contract .rc-remark .value { flex: 1; word-break: break-word; }
@media (max-width: 720px) {
  .renewal-contract .rc-stats { grid-template-columns: 1fr 1fr; }
  .renewal-contract .rc-grid { grid-template-columns: 1fr; }
}

/* 客户列表「已续费」小蓝标：名称列是 ellipsis 裁剪列，徽章必须自带 white-space */
.data-table.cust-table .name-renew-badge {
  display: inline-block;
  font-size: 11px;
  line-height: 1.65;
  padding: 0 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: 1.5px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(79, 140, 255, .20);
  color: #7fb0ff;
  border: 1px solid rgba(79, 140, 255, .45);
  cursor: help;
}


/* === 状态日志时间线 === */
.status-log-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.status-log-timeline li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
  border-left: 2px solid var(--border);
  margin-left: 6px;
  padding-left: 16px;
}
.status-log-timeline li:first-child { padding-top: 0; }
.status-log-timeline li:last-child { border-left-color: transparent; }
.log-dot {
  position: absolute;
  left: -7px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-light);
  box-shadow: 0 0 0 2px var(--bg-card);
}
.log-dot.log-term { background: var(--danger); }
.log-dot.log-active { background: var(--success); }
.log-dot.log-other { background: var(--info); }
.status-log-timeline li:first-child .log-dot { top: 4px; }
.log-content { flex: 1; min-width: 0; }
.log-line { font-size: 14px; color: var(--text-primary); }
.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.log-note {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-base);
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 4px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .terminated-banner { padding: 12px 14px; }
  .terminated-banner .banner-meta { gap: 4px 12px; }
}

/* ============ 流失分析弹窗 ============ */
.loss-analysis {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.loss-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.loss-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.loss-card-wide { grid-column: 1 / -1; }
.loss-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

/* 12 月柱状趋势图 */
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 110px;
  padding: 4px 0 0 0;
}
.m-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  position: relative;
}
.m-bar {
  width: 80%;
  background: linear-gradient(180deg, var(--primary), var(--bg-card-hover));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: background .2s;
}
.m-bar-col:hover .m-bar { background: var(--primary-hover); }
.m-bar-num {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  min-height: 14px;
}
.m-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Top 排名列表 */
.loss-rank {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 14px;
}
.loss-rank li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
}
.loss-rank li:nth-child(odd) { background: rgba(255,255,255,0.02); }
.rank-num {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  background: var(--border-light);
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.loss-rank li:nth-child(1) .rank-num { background: var(--warning); color: #1a1d24; }
.loss-rank li:nth-child(2) .rank-num { background: var(--text-secondary); color: #1a1d24; }
.loss-rank li:nth-child(3) .rank-num { background: rgba(245,158,11,0.5); color: #1a1d24; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { color: var(--danger); font-weight: 500; }

@media (max-width: 768px) {
  .loss-grid { grid-template-columns: 1fr; }
  .loss-rank { grid-template-columns: 1fr; }
}

/* ============ 仪表盘：合同健康度卡片 ============ */
.health-card .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.health-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.health-tile {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border-left: 3px solid var(--border-light);
}
.health-tile.primary { border-left-color: var(--primary); }
.health-tile.warning { border-left-color: var(--warning); }
.health-tile.danger { border-left-color: var(--danger); }
.health-tile.info { border-left-color: var(--info); }
.health-tile.success { border-left-color: var(--success); }
.health-tile .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.health-tile .value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
@media (max-width: 768px) {
  .health-mini-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 产品类别：分类卡片 / 子目录圆点 / 深色表单字体 ============ */

/* 分类子目录圆点 */
.status-dot-cat { background: var(--primary); box-shadow: 0 0 6px var(--primary); }

/* 分类卡片网格 */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}
.cat-card:hover { border-color: var(--border-light); }
.cat-card-off { opacity: 0.6; }
.cat-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-icon {
  font-size: 26px;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.cat-title { flex: 1; min-width: 0; }
.cat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-count { font-size: 12px; color: var(--text-muted); }
.cat-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-move {
  display: flex;
  gap: 2px;
  margin-left: auto;
}
.cat-move .icon-btn {
  width: 24px; height: 24px;
  font-size: 14px; line-height: 1;
  padding: 0;
  border-radius: 4px;
}
.cat-move .icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 分类图标选择器 */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.icon-opt {
  width: 38px; height: 38px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--text-primary);
}
.icon-opt:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.icon-opt.sel {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.18);
  box-shadow: 0 0 0 1px var(--primary);
}
@media (max-width: 600px) {
  .cat-grid { grid-template-columns: 1fr; }
}

/* 深色主题：表单输入/选择/文本域字体统一为白色
   （修复 .form-field-row 内控件缺 .form-field 导致的白底浅字问题） */
.form-field-row input,
.form-field-row select,
.form-field-row textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s;
}
.form-field-row input:focus,
.form-field-row select:focus,
.form-field-row textarea:focus { border-color: var(--primary); }
.form-field-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.form-field-row textarea { resize: vertical; min-height: 70px; }

/* 弹窗内所有表单控件强制深底白字，避免浏览器原生白底 */
.modal-box input,
.modal-box select,
.modal-box textarea {
  color: var(--text-primary);
  background: var(--bg-input);
}
.modal-box input::placeholder,
.modal-box textarea::placeholder { color: var(--text-muted); }
.modal-box select option {
  color: var(--text-primary);
  background: var(--bg-card);
}


.attach-list .att-del:hover { background: var(--bg-hover); }
/* 表格单元格文本省略（客户名称列限宽） */
.cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 原生日期/月份/时间控件：日历图标统一替换为绿色（2026-09-09） ===== */
input[type="date"],
input[type="month"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: dark;   /* 仅影响弹出的选择面板深浅 */
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>") center / 20px 20px no-repeat;
  cursor: pointer;
  opacity: 1;
}

/* ===== 月份下拉（工资核算 / 我的工资）：白色下拉箭头 ===== */
.month-select {
  min-width: 160px;
  background-color: #2a2a2e;
  color: #eee;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px 30px 8px 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='white' d='M1.4 0l4.6 4.6L10.6 0 12 1.4 6 7.4 0 1.4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ===== 收款页：居中金色大按钮 + 一次性业务候选行（2026-09-09） ===== */
.pay-quickbar {
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
}
.btn-gold {
  background: linear-gradient(180deg, #ffd34d, #f0b400);
  color: #1c1200;
  font-weight: 700;
  border: 1px solid #d9a300;
  box-shadow: 0 2px 8px rgba(240, 180, 0, .35);
}
.btn-gold:hover { background: linear-gradient(180deg, #ffe07a, #f6bd0e); color: #1c1200; transform: translateY(-1px); }
.btn-gold-lg {
  font-size: 20px;
  padding: 14px 46px;
  border-radius: 12px;
}
.ot-cand {
  padding: 7px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.ot-cand:hover { background: var(--bg-card-hover); }

/* ===== 客户操作记录：动作色点与变更明细（2026-09-14） ===== */
.log-dot.log-info { background: var(--primary); }
.log-dot.log-pay { background: #f0b400; }
.log-group { margin-top: 6px; }
.log-group-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 6px 0 2px;
  padding-left: 6px;
  border-left: 3px solid var(--border);
}
.log-change {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 2px 0 2px 10px;
  line-height: 1.6;
}
.log-field { color: var(--text-muted); margin-right: 6px; }
.log-old { color: var(--text-muted); text-decoration: line-through; }
.log-arrow { color: var(--text-muted); margin: 0 6px; }
.log-new { color: var(--text-primary); font-weight: 600; }
