/* ==========================================================
   启弘财税 - 后台管理系统
   基础样式（零依赖，离线可用）
   ========================================================== */

:root {
  --primary: #3d7eff;
  --primary-hover: #5a90ff;
  --primary-light: #eaf1ff;
  --primary-dark: #2b62d6;

  --success: #22a06b;
  --success-light: #e6f6ef;
  --warning: #e8890c;
  --warning-light: #fdf2e2;
  --danger: #e5484d;
  --danger-light: #fdecec;
  --info: #6b7280;
  --info-light: #f3f4f6;

  --sidebar-bg: #263445;
  --sidebar-bg-dark: #1d2938;
  --sidebar-text: #b0bece;
  --sidebar-text-active: #ffffff;
  --sidebar-divider: #33455a;

  --bg-body: #f2f4f7;
  --bg-card: #ffffff;
  --bg-hover: #f7f9fc;

  --text-primary: #1f2937;
  --text-regular: #4b5563;
  --text-secondary: #8c93a1;
  --text-placeholder: #b4b9c4;

  --border: #e5e8ee;
  --border-light: #eef1f5;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 8px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);

  --sidebar-w: 76px;
  --submenu-w: 156px;
  --topbar-h: 52px;
  --tabs-h: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }
a { color: var(--primary); text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cdd3dd; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b3bbc8; }

/* ============================ 布局 ============================ */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- 一级导航 ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  flex-shrink: 0;
  border-bottom: 1px solid var(--sidebar-divider);
}
.logo-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #4d8dff, #2f6ae0);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-size: 13px; font-weight: 500; letter-spacing: .5px; }

.nav-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 20px; }
.nav-main::-webkit-scrollbar { width: 0; }

.nav-item {
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--sidebar-text);
  cursor: pointer;
  position: relative;
  transition: background .16s, color .16s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--sidebar-bg-dark); color: var(--sidebar-text-active); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 19px; height: 19px; stroke-width: 1.7; }
.nav-item .nav-label { font-size: 11px; line-height: 1; white-space: nowrap; }

/* ---------- 二级菜单 ---------- */
.submenu {
  width: var(--submenu-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 15;
}
.submenu-head {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.submenu-list { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.submenu-item {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 16px 0 18px;
  font-size: 13px;
  color: var(--text-regular);
  cursor: pointer;
  position: relative;
  transition: background .14s, color .14s;
}
.submenu-item:hover { background: var(--bg-hover); color: var(--primary); }
.submenu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.submenu-item.active::after {
  content: '';
  position: absolute; right: 0; top: 9px; bottom: 9px;
  width: 3px; background: var(--primary); border-radius: 3px 0 0 3px;
}
.submenu-empty { padding: 16px; font-size: 12px; color: var(--text-placeholder); text-align: center; }

/* ---------- 主区域 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
}
.global-search {
  width: 260px; height: 32px;
  background: var(--bg-body);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text-regular);
}
.global-search::placeholder { color: var(--text-placeholder); }
.global-search:focus { background: #fff; border-color: var(--primary); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-btn {
  height: 32px; padding: 0 11px;
  display: inline-flex; align-items: center; gap: 5px;
  border: none; background: transparent; border-radius: 6px;
  color: var(--text-regular); cursor: pointer; font-size: 13px;
  position: relative;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--primary); }
.tb-btn svg { width: 17px; height: 17px; stroke-width: 1.7; }
.tb-badge {
  position: absolute; top: 1px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff;
  border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center;
}
.user-box {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px 3px 3px; border-radius: 18px; cursor: pointer;
  transition: background .14s;
}
.user-box:hover { background: var(--bg-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #4d8dff, #2f6ae0);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
}
.user-name { font-size: 13px; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-secondary); }

/* ---------- 页签 ---------- */
.tabs {
  height: var(--tabs-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 4px;
  overflow-x: auto;
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-regular);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: all .14s;
}
.tab:hover { color: var(--primary); border-color: #c7d9fc; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-close {
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; opacity: .55;
}
.tab-close:hover { background: rgba(0,0,0,.16); opacity: 1; }
.tab.active .tab-close:hover { background: rgba(255,255,255,.28); }

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.page { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 19px; font-weight: 500; margin: 0 0 4px; }
.page-desc { font-size: 13px; color: var(--text-secondary); margin: 0; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.card + .card { margin-top: 14px; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.grid-2 > .card { margin-top: 0; }
.grid-2 > .card + .card { margin-top: 0; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.card-title::before {
  content: ''; width: 3px; height: 13px;
  background: var(--primary); border-radius: 2px;
}
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ============================ 按钮 ============================ */
.btn {
  height: 32px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-regular);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all .14s;
  white-space: nowrap;
}
.btn:hover { color: var(--primary); border-color: #b9cffb; background: #fafcff; }
.btn svg { width: 15px; height: 15px; stroke-width: 1.8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f5c5c6; }
.btn-danger:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-text {
  border: none; background: transparent; color: var(--primary);
  padding: 0 6px; height: auto; font-size: 13px;
}
.btn-text:hover { background: transparent; text-decoration: underline; }
.btn-text.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* 灰掉的操作（如未报价时的「建合同」）：保留位置但明确不可点，hover 出原因 */
.btn-text.off {
  color: var(--text-secondary); opacity: .55;
  cursor: not-allowed; text-decoration: none;
}
.btn-text.off:hover { background: transparent; text-decoration: none; }

/* ============================ 表单控件 ============================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--text-regular); }
.field-label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color .14s, box-shadow .14s;
  width: 100%;
}
.textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61, 126, 255, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-placeholder); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c93a1' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px;
}

/* ---------- 筛选区 ---------- */
.filters {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px 16px;
}
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item > label {
  font-size: 13px; color: var(--text-regular);
  white-space: nowrap; min-width: 62px; text-align: right;
}
.filter-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ---------- 筛选条（密集筛选区，对齐参考站的线索页） ---------- */
.lead-toolbar {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.lead-search {
  width: 330px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-primary); background: #fff; outline: none;
}
.lead-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }

.fbar {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 18px 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.fb-row { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.fb-row + .fb-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-light); }
.fb-group { display: flex; align-items: center; gap: 8px; }
.fb-label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.fb-date {
  height: 28px; padding: 0 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-regular); background: #fff; outline: none;
}
.fb-date:focus { border-color: var(--primary); }
.fb-sep { font-size: 12px; color: var(--text-placeholder); }
.fb-select { height: 28px; min-width: 118px; font-size: 12px; padding: 0 6px; }
.fb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fb-chip {
  height: 26px; padding: 0 10px; border-radius: 13px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; color: var(--text-regular); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .14s;
}
.fb-chip i { font-style: normal; color: var(--primary); font-weight: 600; }
.fb-chip:hover { border-color: #c7d9fc; color: var(--primary); }
.fb-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fb-chip.active i { color: #fff; }
.fb-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-light);
}
.fb-toggle, .fb-save {
  border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--primary);
  display: inline-flex; align-items: center; gap: 4px; padding: 0;
  white-space: nowrap; flex: 0 0 auto;
}
.fb-toggle svg, .fb-save svg { width: 13px; height: 13px; stroke-width: 2.2; }
.fb-save { margin-left: auto; }
.fb-caret {
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; transition: transform .16s;
}
.fb-caret.up { transform: rotate(180deg); }
.fb-saved { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 1 auto; min-width: 0; }
.fb-saved-item {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--bg-hover); overflow: hidden;
}
.fb-saved-item > button {
  border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--text-regular);
  padding: 0 4px 0 10px; height: 24px;
}
.fb-saved-item:hover > button { color: var(--primary); }
.fb-saved-del {
  width: 18px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-placeholder); cursor: pointer;
}
.fb-saved-del:hover { background: var(--danger-light); color: var(--danger); }
/* 工作台页签固定在最左，不带关闭按钮 */
.tab.tab-home { padding-right: 12px; }

/* ---------- 快筛标签 ---------- */
.quick-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}
.qf {
  height: 30px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 15px; font-size: 13px; color: var(--text-regular);
  cursor: pointer; transition: all .14s;
}
.qf:hover { border-color: #b9cffb; color: var(--primary); }
.qf.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.qf-num { font-weight: 500; }
.qf.active .qf-num { color: #fff; }

/* ---------- 三级页签 ---------- */
.sub-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.sub-tab {
  height: 36px; padding: 0 16px;
  border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .14s;
}
.sub-tab:hover { color: var(--primary); }
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- 详情字段表 ---------- */
.desc-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.desc-item {
  display: flex; gap: 10px; padding: 11px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 13px;
}
.desc-label { flex: 0 0 92px; color: var(--text-secondary); }
.desc-value { flex: 1; color: var(--text); word-break: break-all; }
.desc-item.span-3 { grid-column: span 3; }

/* ============================ 统计卡 ============================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 500; line-height: 1.2; letter-spacing: -.4px; }
.stat-value .unit { font-size: 13px; font-weight: 400; color: var(--text-secondary); margin-left: 3px; }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.stat-icon {
  position: absolute; right: 14px; top: 14px;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 18px; height: 18px; stroke-width: 1.7; }

/* ---------- 可跳转的数据卡 / 排行项 ---------- */
.stat-link { cursor: pointer; transition: box-shadow .16s, border-color .16s, transform .16s; }
.stat-link:hover {
  border-color: var(--primary, #3d7eff);
  box-shadow: 0 4px 14px rgba(61, 126, 255, .16);
  transform: translateY(-1px);
}
.stat-link:active { transform: translateY(0); }
.stat-goto {
  display: flex; align-items: center; gap: 3px;
  margin-top: 9px;
  font-size: 12px; color: var(--primary, #3d7eff);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .16s, transform .16s;
}
.stat-goto svg { width: 13px; height: 13px; stroke-width: 1.9; }
.stat-link:hover .stat-goto { opacity: 1; transform: translateX(0); }
.rank-link { cursor: pointer; border-radius: 6px; padding: 3px 5px; margin: -3px -5px; transition: background .14s; }
.rank-link:hover { background: rgba(61, 126, 255, .07); }
.rank-link:hover .rank-name { color: var(--primary, #3d7eff); }
.donut-arc { transition: opacity .14s; }
.donut-arc:hover { opacity: 1; }

/* ---------- 工作台：快捷操作 ---------- */
/* 固定 6 列：12 项正好排满 2 行，不会出现落单的尾巴 */
.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 1180px) { .quick-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s, transform .14s;
}
.quick-item:hover { background: rgba(61, 126, 255, .06); border-color: rgba(61, 126, 255, .18); transform: translateY(-1px); }
/* ---------- 工作台：可跳转行 / 副标题链接 ---------- */
.stat-sub-link,
.todo-link { cursor: pointer; }
.stat-sub-link {
  color: var(--primary);
  transition: opacity .14s;
}
.stat-sub-link:hover { opacity: .75; text-decoration: underline; }
.todo-link { border-radius: 6px; transition: background .14s; }
.todo-link:hover { background: rgba(61, 126, 255, .06); }
.setup-item { transition: border-color .14s, transform .14s; }
.setup-item:hover { transform: translateY(-1px); }

.quick-item .quick-i {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.quick-item .quick-i svg { width: 17px; height: 17px; stroke-width: 1.7; }
.quick-item .quick-name { font-size: 12.5px; color: var(--text-regular); }

.trend-up { color: var(--danger); }
.trend-down { color: var(--success); }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
  background: #f8fafc;
  color: var(--text-regular);
  font-weight: 500;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-regular);
  vertical-align: middle;
}
table.tbl tbody tr:hover td { background: #fafcff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .strong { color: var(--text-primary); font-weight: 500; }
table.tbl .muted { color: var(--text-secondary); }
table.tbl .actions { white-space: nowrap; text-align: right; }
table.tbl th.center, table.tbl td.center { text-align: center; }

.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-placeholder);
}
.empty-state svg { width: 46px; height: 46px; stroke-width: 1.2; margin-bottom: 10px; opacity: .5; }
.empty-state p { margin: 0; font-size: 13px; }

/* ============================ 标签 ============================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.tag-primary { background: var(--primary-light); color: var(--primary-dark); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-info { background: var(--info-light); color: var(--info); }
.tag-plain { background: #fff; border: 1px solid var(--border); color: var(--text-regular); }

/* 配色工具类（表尾合计 / 工资表同比等） */
.c-success { color: var(--success); }
.c-warning { color: var(--warning); }
.c-danger { color: var(--danger); }
.c-primary { color: var(--primary); }
.c-info { color: var(--info); }

/* 财务字典（设置-财务设置）：可维护类型字典 */
.dict-sec { padding: 10px 0; border-bottom: 1px dashed var(--border-light); }
.dict-sec:last-child { border-bottom: 0; }
.dict-sec-h { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.dict-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.dict-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 14px; padding: 3px 6px 3px 11px; font-size: 12.5px; }
.dict-del { border: 0; background: transparent; color: var(--text-tertiary); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.dict-del:hover { color: var(--danger); }
.dict-add { display: flex; gap: 8px; align-items: center; }
.dict-add .input { flex: 1; max-width: 320px; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ============================ 分页 ============================ */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.pager-total { margin-right: auto; }
.pg-list { display: flex; gap: 4px; }
.pg {
  min-width: 28px; height: 28px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 5px;
  background: #fff; color: var(--text-regular);
  cursor: pointer; font-size: 13px;
}
.pg:hover { color: var(--primary); border-color: #b9cffb; }
.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg:disabled { opacity: .45; cursor: not-allowed; }

/* ============================ 抽屉 / 弹窗 ============================ */
.mask {
  position: fixed; inset: 0;
  background: rgba(23, 31, 44, .45);
  z-index: 100;
  animation: maskIn .18s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 560px; max-width: 92vw;
  background: #fff;
  z-index: 101;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: drawerIn .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
/* 宽抽屉：报价单 / 合同这类多段长表单用（对齐参考站的全屏右侧抽屉） */
.drawer.wide { width: 940px; }
@media (max-width: 1100px) { .drawer.wide { width: 92vw; } }
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title { font-size: 15px; font-weight: 500; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}
.icon-btn {
  width: 28px; height: 28px;
  border: none; background: transparent; border-radius: 6px;
  color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 1.9; }

.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 520px; max-width: 94vw;
  max-height: 88vh;
  background: #fff; border-radius: var(--radius-lg);
  z-index: 101;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modalIn { from { transform: translate(-50%, -46%) scale(.98); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.modal.wide { width: 720px; }
/* 合同详情：正文是整份 A4 文档，720px 会被挤窄，单独加宽 */
.modal.wide.modal-contract { width: 980px; }
@media (max-width: 1100px) { .modal.wide.modal-contract { width: 96vw; } }
/* 首付/尾款徽章（此前缺样式，会与状态标签挤成一行裸文字） */
.cm-sub { font-size: 12px; color: var(--text-secondary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* 详情信息列表 */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex; gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 104px; color: var(--text-secondary); flex-shrink: 0; }
.info-row .v { color: var(--text-primary); flex: 1; word-break: break-all; }

.section-title {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  margin: 20px 0 10px; padding-left: 9px;
  border-left: 3px solid var(--primary);
  line-height: 1.2;
}
.section-title:first-child { margin-top: 0; }

/* ============================ 时间线 ============================ */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary);
}
.tl-item.done::before { background: var(--primary); }
.tl-item.gray::before { border-color: var(--text-placeholder); }
.tl-title { font-size: 13px; color: var(--text-primary); margin-bottom: 3px; }
.tl-meta { font-size: 12px; color: var(--text-secondary); }
.tl-desc { font-size: 13px; color: var(--text-regular); margin-top: 5px; line-height: 1.6; }
.tl-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-light); cursor: pointer; }
.tl-img:hover { opacity: .85; }

/* ============================ 进度条 ============================ */
.bar { height: 6px; background: #eef1f5; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width .3s; }

/* ============================ 图表 ============================ */
.chart-box { width: 100%; overflow: hidden; }
.chart-box svg { display: block; width: 100%; height: auto; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; }

/* 柱状排行 */
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-item { display: flex; flex-direction: column; gap: 6px; }
.rank-top { display: flex; justify-content: space-between; font-size: 13px; }
.rank-name { color: var(--text-primary); }
.rank-val { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ============================ 快捷上手 ============================ */
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.setup-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer; transition: all .16s;
}
.setup-item:hover { border-color: #c7d9fc; background: #fafcff; }
.setup-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: transparent;
}
.setup-item.done .setup-check { background: var(--success); border-color: var(--success); color: #fff; }
.setup-item.done .setup-name { color: var(--text-secondary); }
.setup-check svg { width: 13px; height: 13px; stroke-width: 3; }
.setup-info { flex: 1; min-width: 0; }
.setup-name { font-size: 13px; color: var(--text-primary); margin-bottom: 3px; }
.setup-desc { font-size: 12px; color: var(--text-secondary); }

/* ============================ 待办 ============================ */
.todo-group { display: flex; flex-direction: column; }
.todo-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.todo-row:last-child { border-bottom: none; }
.todo-tag { flex-shrink: 0; }
.todo-text { flex: 1; color: var(--text-primary); min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-time { color: var(--text-secondary); font-size: 12px; flex-shrink: 0; }

/* ============================ 日历 ============================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  height: 54px; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 12px; color: var(--text-regular); cursor: pointer;
  border: 1px solid transparent;
}
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.today { background: var(--primary); color: #fff; font-weight: 500; }
.cal-cell.has { border-color: #c7d9fc; }
.cal-cell .cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.cal-cell.today .cal-dot { background: #fff; }
.cal-head { font-size: 12px; color: var(--text-secondary); text-align: center; padding: 6px 0; }

/* ============================ 其他 ============================ */
.split { display: grid; gap: 14px; }
.split-2 { grid-template-columns: 1fr 1fr; }
.split-3 { grid-template-columns: repeat(3, 1fr); }
.split-main-side { grid-template-columns: 1fr 340px; }

.mt-14 { margin-top: 14px; }
.mb-14 { margin-bottom: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.text-secondary { color: var(--text-secondary); }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.muted { color: var(--text-secondary); }
.strong { color: var(--text-primary); font-weight: 500; }
.nowrap { white-space: nowrap; }

/* Toast */
.toast-box {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 9px 16px; border-radius: 7px; font-size: 13px;
  background: #fff; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .2s ease;
  max-width: 420px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.toast.success { border-color: #b7e4cd; background: #f2fbf6; color: #14663f; }
.toast.error { border-color: #f5c5c6; background: #fef5f5; color: #9c2b2e; }
.toast.info { border-color: #c7d9fc; background: #f5f9ff; color: #2b5bb5; }

@media (max-width: 1100px) {
  .split-2, .split-3, .split-main-side { grid-template-columns: 1fr; }
  .global-search { width: 150px; }
}
@media (max-width: 820px) {
  .submenu { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   部门员工 / 组织架构 / 权限树
   ========================================================== */
.split-tree { grid-template-columns: 268px 1fr; }
@media (max-width: 1100px) { .split-tree { grid-template-columns: 1fr; } }

/* ---------- 部门树 ---------- */
.dept-panel { display: flex; flex-direction: column; }
.dept-panel .card-head { flex-shrink: 0; }
.dept-panel .tree-scroll { max-height: 620px; overflow-y: auto; }

.tree { padding: 6px 0; }
.tnode-row {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px; border-radius: 6px;
  cursor: pointer; position: relative; color: var(--text-regular);
  transition: background .12s;
}
.tnode-row:hover { background: var(--bg-hover); }
.tnode-row.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.tnode-chev { width: 14px; height: 14px; flex-shrink: 0; opacity: .55; transition: transform .15s; }
.tnode-chev.open { transform: rotate(90deg); }
.tnode-chev.leaf { opacity: 0; }
.tnode-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.tnode-label { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tnode-count { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.tnode-row.active .tnode-count { color: var(--primary); }
.tnode-ops { display: none; gap: 2px; flex-shrink: 0; }
.tnode-row:hover .tnode-ops, .tnode-row.active .tnode-ops { display: flex; }
.tnode-op {
  width: 22px; height: 22px; border: none; background: transparent; border-radius: 4px;
  color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tnode-op:hover { background: var(--primary-light); color: var(--primary); }
.tnode-op.del:hover { background: var(--danger-light); color: var(--danger); }
.tnode-op svg { width: 13px; height: 13px; stroke-width: 1.9; }
.tnode-children { padding-left: 18px; }
.tree-empty { padding: 18px 12px; font-size: 12px; color: var(--text-placeholder); text-align: center; }

/* ---------- 表单分组（抽屉 / 弹窗） ---------- */
.form-section { margin-bottom: 20px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  padding-left: 8px; border-left: 3px solid var(--primary); margin-bottom: 14px; line-height: 1.2;
}
.form-grid.g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .form-grid.g3 { grid-template-columns: 1fr 1fr; } }
.field-hint { font-size: 11px; color: var(--text-placeholder); margin-top: 4px; }
.check-line { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--text-regular); user-select: none; }
.check-line input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.divider { height: 1px; background: var(--border-light); margin: 18px 0; }

/* ---------- 权限树 ---------- */
.perm-tree { display: flex; flex-direction: column; gap: 10px; }
.pmod { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pmod-head {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  background: var(--bg-hover); cursor: pointer;
}
.pmod-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.pmod-meta { font-size: 11px; color: var(--text-secondary); margin-left: auto; }
.pmod-body { padding: 6px 12px 10px; display: none; }
.pmod.open .pmod-body { display: block; }
.pmod-head input[type=checkbox],
.psub-head input[type=checkbox],
.pops input[type=checkbox] { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.pmod-title { cursor: pointer; user-select: none; }
.psub { padding: 9px 0; border-top: 1px dashed var(--border-light); }
.psub:first-child { border-top: none; }
.psub-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.psub-title { font-size: 13px; color: var(--text-regular); margin-right: auto; }
.psub-note { font-size: 11px; color: var(--text-placeholder); font-family: ui-monospace, Menlo, Consolas, monospace; }
.pops { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-left: 22px; }
.pop-wrap { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); cursor: pointer; user-select: none; }

/* ---------- 员工卡片头（抽屉内） ---------- */
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.person-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 500;
}
.person-name { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.person-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

/* ---------- 确认弹窗正文 ---------- */
.confirm-text { font-size: 13px; color: var(--text-regular); line-height: 1.7; }
.confirm-text .hl { color: var(--danger); font-weight: 500; }
.confirm-tip { margin-top: 10px; padding: 9px 12px; background: var(--warning-light); border-radius: 6px; font-size: 12px; color: #8a5208; }

/* ==========================================================
   销售漏斗状态条 / 线索池标记
   ========================================================== */
.funnel {
  display: flex; flex-wrap: wrap; gap: 2px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 8px;
}
.fitem {
  flex: 1 1 auto; min-width: 76px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 6px; border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit; transition: background .14s;
}
.fitem:hover { background: var(--bg-hover); }
.fitem.active { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.fnum { font-size: 16px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.ftitle { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }
.fitem.active .fnum, .fitem.active .ftitle { color: #fff; }

/* 数字套红气泡：用于「待分配」这类需要催办的 */
.fitem.bubble .fnum {
  min-width: 20px; padding: 0 6px; background: var(--danger);
  color: #fff; border-radius: 10px; font-size: 12px; line-height: 18px;
}
.fitem.bubble.active .fnum { background: rgba(255, 255, 255, .26); }
/* 数字和标题标红：用于「7天未跟进」这类预警 */
.fitem.warn .fnum, .fitem.warn .ftitle { color: var(--danger); }
.fitem.warn.active .fnum, .fitem.warn.active .ftitle { color: #fff; }
/* 数量为 0 时压暗，避免满屏噪音 */
.fitem.zero .fnum { color: var(--text-placeholder); }
.fitem.zero.active .fnum { color: rgba(255, 255, 255, .55); }

/* 线索池标记 */
.pool-tag {
  display: inline-flex; align-items: center; gap: 3px;
  height: 18px; padding: 0 6px; border-radius: 3px;
  font-size: 11px; line-height: 1;
}
.pool-tag.pool-pending { background: var(--warning-light); color: #8a5208; }
.pool-tag.pool-public { background: var(--info-light); color: #4b5563; }
.owner-empty { color: var(--text-placeholder); }

/* 逾期天数 */
.overdue { color: var(--danger); font-weight: 500; }
.due-soon { color: var(--warning); font-weight: 500; }

/* ==========================================================
   报价单 / 合同：长表单（宽抽屉）
   对齐参考站「填写报价」「创建合同」的三段式排版
   ========================================================== */
.q-hint { font-size: 12px; color: var(--warning); margin: -6px 0 10px; }
.q-sec {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  padding: 7px 0 7px 10px; border-left: 3px solid var(--primary);
  margin: 18px 0 12px;
  background: linear-gradient(90deg, var(--primary-light), rgba(234,241,255,0));
}
.q-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.q-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.q-span2 { grid-column: span 2; }
.q-label { font-size: 12.5px; color: var(--text-secondary); }
.q-readonly {
  height: 34px; line-height: 34px; padding: 0 10px; border-radius: 6px;
  background: var(--bg-body); color: var(--text-regular); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.q-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-regular); height: 34px; cursor: pointer;
}
/* 合同表单：永久性地址 / 负责工商变更 —— 显眼开关块 */
.q-switch-on {
  border: 1px dashed #b9c8e6; background: #f6f9ff; border-radius: 8px;
  padding: 8px 12px; flex-direction: row; align-items: center; justify-content: space-between;
}
.q-switch-on .q-label { font-weight: 600; color: #1f2430; }
.q-switch-on .q-inline { height: auto; }

/* 服务项分块 */
.q-block { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.q-dash { border-style: dashed; border-color: #c9dcff; background: #fbfdff; }
.q-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.q-title { font-size: 13px; font-weight: 600; font-style: normal; }
.q-block .q-grid { margin-top: 12px; }
.q-block .q-grid:first-child { margin-top: 0; }

/* 开关（有/无） */
.q-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.q-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.q-switch .q-track {
  width: 36px; height: 20px; border-radius: 10px; background: #d7dde5;
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.q-switch .q-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transition: transform .18s;
}
.q-switch input:checked + .q-track { background: var(--primary); }
.q-switch input:checked + .q-track::after { transform: translateX(16px); }
.q-switch em { font-style: normal; font-size: 13px; font-weight: 600; }
.q-state { font-size: 12px; color: var(--text-secondary); }

/* 增值服务多行表 */
.q-items { width: 100%; border-collapse: collapse; margin-top: 10px; table-layout: fixed; }
.q-items th { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-align: left; padding: 2px 6px 6px; }
.q-items td { padding: 3px 6px; vertical-align: middle; }
.q-items th:first-child, .q-items td:first-child { width: 34%; }
.q-items th:nth-child(2), .q-items td:nth-child(2),
.q-items th:nth-child(3), .q-items td:nth-child(3) { width: 15%; }
.q-items th:last-child, .q-items td:last-child { width: 52px; text-align: right; }
.q-cell { width: 100%; height: 32px; font-size: 12.5px; }
.q-empty { font-size: 12.5px; color: #9ca3af; padding: 12px 6px; text-align: center; }

/* 底部总报价 */
.q-foot-total { margin-right: auto; display: flex; align-items: baseline; gap: 8px; }
.q-foot-label { font-size: 13px; color: var(--text-secondary); }
.q-foot-num { font-size: 18px; color: var(--danger); font-weight: 600; }
.q-foot-sub { font-size: 12px; color: var(--text-secondary); }

/* 报价单 / 合同 文档预览（抽屉里的 A4 纸） */
.doc {
  background: #fff; border: 1px solid var(--border-light);
  padding: 28px 30px; font-size: 13px; line-height: 1.9; color: var(--text-regular);
  position: relative; overflow: hidden;
}
.doc h1 { font-size: 19px; text-align: center; margin: 0 0 6px; letter-spacing: 2px; color: var(--text-primary); }
.doc .doc-sub { text-align: center; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 18px; }
.doc .void-banner { background: #fdecec; color: #c0392b; border: 1px solid #f3b7b7; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.doc h2 { font-size: 13.5px; margin: 16px 0 6px; color: var(--text-primary); }
.doc p { margin: 0 0 8px; }
.doc .doc-line { border-top: 1px dashed var(--border); margin: 16px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.doc table th, .doc table td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; }
.doc table th { background: var(--bg-hover); font-weight: 600; }
.doc table td.num, .doc table th.num { text-align: right; white-space: nowrap; }
.doc .doc-total { text-align: right; font-size: 14px; margin-top: 10px; }
.doc .doc-total b { color: var(--danger); font-size: 17px; }
.doc .doc-cap { text-align: right; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.doc .doc-foot { margin-top: 20px; font-size: 12px; color: var(--text-secondary); line-height: 1.8; }
.doc .doc-watermark {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 34px 40px; padding: 14px;
}
.doc .doc-watermark span {
  font-size: 15px; color: rgba(61, 126, 255, .07); font-weight: 700;
  transform: rotate(-22deg); white-space: nowrap;
}
.doc-contract { font-size: 12.5px; line-height: 2; }
/* 报价单：参考站「服务报价说明书」式样（纸张固定配色，深浅主题下都按白纸呈现） */
.doc .qdoc { position: relative; }
.doc .qdoc-logo { display: block; height: 40px; width: auto; margin: 0 0 10px; }
.doc .qdoc-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #6b7280; border-bottom: 1px solid #e3e6ec; padding-bottom: 9px; margin-bottom: 16px; }
.doc .qdoc-box { border: 1px solid #d7dbe3; padding: 22px 24px; position: relative; }
.doc .qdoc-to { font-size: 14px; color: #1f2430; margin: 0 0 10px; }
.doc .qdoc-lead-note { font-size: 12.5px; color: #5b6573; background: #f4f7fb; border-left: 3px solid #c8161d; padding: 7px 10px; margin: 0 0 10px; border-radius: 0 4px 4px 0; line-height: 1.7; }
.doc .qdoc-thx { font-size: 13px; color: #4a5568; margin: 0 0 4px; }
.doc .qdoc-h { font-size: 14px; color: #1f2430; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 2px solid #1f2430; }
.doc .qdoc-svc { font-size: 13px; color: #4a5568; margin: 8px 0; }
.doc .qdoc-svc b { color: #1f2430; margin-right: 4px; }
.doc .qdoc-tb { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 0; }
.doc .qdoc-tb th { text-align: left; font-weight: 600; color: #1f2430; padding: 8px 0; border: 0; border-bottom: 1px solid #d7dbe3; background: none; }
.doc .qdoc-tb td { padding: 10px 0; vertical-align: top; color: #4a5568; border: 0; border-bottom: 1px dashed #eef0f4; }
.doc .qdoc-tb .proj { white-space: nowrap; color: #1f2430; }
.doc .qdoc-tb .desc { line-height: 1.7; }
.doc .qdoc-tb .price, .doc .qdoc-tb th.price { text-align: right; color: #1f9d55; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc .qdoc-sum { margin-top: 16px; text-align: right; font-size: 13px; color: #4a5568; line-height: 2; padding-right: 110px; }
.doc .qdoc-sum em { font-style: normal; color: #1f9d55; font-weight: 600; font-variant-numeric: tabular-nums; }
.doc .qdoc-grand { font-size: 15px; color: #1f2430; }
.doc .qdoc-grand em { font-size: 19px; font-weight: 700; }
.doc .qdoc-cap { font-size: 12px; color: #8b93a3; margin-top: 2px; }
.doc .qdoc-stamp { position: absolute; right: -12px; bottom: -72px; width: 132px; height: 132px; opacity: .78; transform: rotate(-9deg); pointer-events: none; }
.doc .qdoc-foot { margin-top: 18px; font-size: 12.5px; color: #4a5568; line-height: 1.95; }
.q-star { color: var(--danger); font-style: normal; margin-right: 2px; }

/* 报价单：左表单 + 右实时预览（对齐参考站「所见即所得」） */
.qf-layout { display: flex; gap: 0; align-items: stretch; }
.qf-form { flex: 1 1 46%; min-width: 360px; padding-right: 18px; }
.qf-preview { flex: 1 1 54%; min-width: 380px; border-left: 1px solid var(--border-light); background: #f5f6f8; padding: 16px; }
.qf-preview-head { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.qf-preview-head small { font-weight: 400; font-size: 11.5px; color: var(--text-secondary); }
.qf-preview-doc { /* 让纸张在窄栏里铺满且不被过度挤压 */ }
.qf-preview-doc .doc { width: 100%; max-width: none; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

/* label 当按钮用（合同模板的上传按钮要套 file input） */
label.btn { cursor: pointer; user-select: none; }
/* 文字按钮里的图标：不给尺寸会被撑成 100% 宽（大加号事故） */
.btn-text svg { width: 13px; height: 13px; stroke-width: 1.9; vertical-align: -2px; }
/* 占位符 */
code {
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 12.5px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
}
.q-note { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.q-tip { font-size: 11.5px; color: var(--text-secondary); font-weight: 400; }

/* 表格底部合计条（合同列表「总计金额」） */
.tbl-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 18px; border-top: 1px solid var(--border-light);
  font-size: 13px; background: var(--bg-hover);
}

/* 企服工单：渠道与付款编辑区 */
.qifu-channel-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 4px 0 8px; }
.qifu-channel-edit .field { min-width: 200px; margin: 0; }

/* 企服工单：客户资料收集（拖拽上传 + 文件列表） */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: 10px;
  padding: 22px 16px; text-align: center; color: var(--text-secondary);
  font-size: 13px; transition: .15s; background: var(--bg-hover);
}
.dropzone.over { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.btn-link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.file-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--border-light); border-radius: 8px; background: var(--bg);
}
.file-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-light); flex: 0 0 auto; }
.file-ico { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 6px; background: var(--primary-light);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--primary); }
.file-ico svg { width: 18px; height: 18px; }
.file-ico .fi-ext { font-size: 9px; font-weight: 700; letter-spacing: .3px; margin-bottom: 1px; }
.file-meta { flex: 1 1 auto; min-width: 0; }
.file-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 11px; color: var(--text-secondary); }
.file-ops { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.empty-mini { font-size: 12px; color: var(--text-secondary); padding: 14px 0; text-align: center; }

/* 企服工单：费用与利润 */
.qf-profit-box { background: #f3faf4; color: #1a7f37; font-weight: 700; border-color: #b6e3c4; }
.qf-profit-text { color: #1a7f37; font-weight: 700; }
.qf-loss-text { color: #d23f3f; font-weight: 700; }
.qifu-need {
  font-size: 13px; line-height: 1.7; color: var(--text);
  background: var(--bg-hover); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word;
}

/* 按钮变体 */
.btn-warning { color: #b76e00; border-color: #f0d29a; background: #fff7e8; }
.btn-warning:hover { background: #fdeecd; color: #b76e00; }
.btn-success { color: #1a7f37; border-color: #b6e3c4; background: #ecfbf0; }
.btn-success:hover { background: #d6f5df; color: #1a7f37; }

/* ---------- R10/R12 收款关联合同 ---------- */
.contract-detail-box { margin: 10px 0 2px; }
.contract-mini { background: #f6f8fc; border: 1px solid #e3e9f4; border-radius: 8px; padding: 12px 14px; }
.contract-mini .cm-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed #e7ecf5; }
.contract-mini .cm-row:last-child { border-bottom: none; }
.contract-mini .cm-row span { color: #6b7280; }
.contract-mini .cm-row b { color: #1f2430; }
.contract-mini .field { margin-top: 10px; }
.ic-card { border: 1px solid #e3e9f4; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.ic-card .ic-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ic-card .ic-head b { font-size: 14px; }
.ic-card .ic-body { font-size: 13px; color: #4b5563; line-height: 1.7; }
.ic-card .ic-body b { color: #1f2430; }
.ic-card .ic-foot { margin-top: 10px; text-align: right; }

/* 跟进历史 / 跟进详情（市场-跟进记录） */
.follow-history { max-height: 240px; overflow: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; }
.follow-hist-item { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.follow-hist-item:last-child { border-bottom: none; }
.fh-meta { font-size: 12px; color: var(--text-secondary); }
.fh-content { margin-top: 3px; white-space: pre-wrap; line-height: 1.6; }
.fh-imgs { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--primary); }
.follow-content { white-space: pre-wrap; padding: 6px 0; line-height: 1.7; }
.follow-imgs { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.follow-img { max-width: 160px; max-height: 160px; border-radius: 6px; border: 1px solid var(--border); }

/* 登录页（团队协同版） */
#login-screen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef3ff 0%, #f7f9fc 100%); }
.login-card { width: 360px; max-width: 92vw; background: #fff; border-radius: 14px; padding: 30px 28px 24px;
  box-shadow: 0 18px 50px rgba(30, 60, 120, 0.16); }
.login-logo { font-size: 22px; font-weight: 700; color: var(--primary); text-align: center; letter-spacing: 1px; }
.login-sub { text-align: center; color: var(--text-secondary); font-size: 13px; margin: 6px 0 18px; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.login-tabs .lt { padding: 8px 14px; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.login-tabs .lt.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.login-input { width: 100%; box-sizing: border-box; padding: 11px 12px; margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s; }
.login-input:focus { border-color: var(--primary); }
.login-err { color: #e23b3b; font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.login-btn { width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; letter-spacing: 2px; }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-btn:hover { background: #2f6ef0; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ===== 合同附件上传 / 预览 ===== */
.cf-attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cf-attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: #eef3ff;
  border: 1px solid #d6e2ff; border-radius: 999px; font-size: 13px; color: #2f6ef0; max-width: 240px; }
.cf-attach-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-attach-x { cursor: pointer; font-weight: 700; color: #e23b3b; padding: 0 2px; }
.cf-attach-x:hover { opacity: .7; }
.cf-detail-sec { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 12px; }
.cf-att-item { margin-bottom: 14px; }
.cf-att-name { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.cf-att-frame { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.cf-att-img { max-width: 100%; max-height: 420px; border: 1px solid var(--border); border-radius: 8px; cursor: zoom-in; }
.cf-att-item .btn-text { margin-right: 14px; }

/* ===== 合同批量录入 ===== */
.batch-tip { background: #eef3ff; border: 1px solid #d6e2ff; color: #2a4a8f; padding: 10px 12px;
  border-radius: 8px; font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
.batch-tip strong { color: #2f6ef0; }
.batch-list { margin-top: 10px; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.batch-table th { text-align: left; padding: 8px 10px; background: #f5f7fa; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); font-weight: 600; }
.batch-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.batch-table .input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.batch-list { overflow-x: auto; }
.batch-table td .select, .batch-table td select { width: 100%; min-width: 120px; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--bg, #fff); }
.batch-table td input[type="date"] { min-width: 140px; }
.batch-table td input[type="number"] { min-width: 72px; }
.batch-scroll { min-width: 100%; }
.batch-table { min-width: 1180px; }
.batch-table td .btn-sm { white-space: nowrap; }
/* 批量录入：左表 + 右预览 双栏 */
.batch-layout { display: flex; gap: 14px; margin-top: 12px; align-items: flex-start; }
.batch-left { flex: 1 1 auto; min-width: 0; }
.batch-right { flex: 0 0 380px; width: 380px; }
.batch-preview { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 8px; height: 64vh; overflow: auto; }
.batch-preview-head { font-size: 12px; color: #666; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; word-break: break-all; }
.batch-pdf { width: 100%; height: calc(64vh - 44px); border: 0; background: #fff; }
.batch-img { max-width: 100%; display: block; }
.modal-batch { width: 1180px; max-width: 96vw; }
@media (max-width: 1100px) {
  .modal-batch { width: 96vw; }
  .batch-right { flex-basis: 320px; width: 320px; }
}
@media (max-width: 860px) {
  .batch-layout { flex-direction: column; }
  .batch-right { flex-basis: auto; width: 100%; }
  .batch-preview { height: 50vh; }
}
/* 批量录入：拆条卡片布局（替代旧表格） */
.batch-card { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px; margin-bottom: 14px; background: #fff; }
.batch-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.batch-card-head .muted { flex: 1; font-weight: 500; word-break: break-all; }
.batch-item { border: 1px dashed var(--border, #e5e7eb); border-radius: 8px; padding: 10px; margin-top: 10px; background: #fafbfc; }
.batch-item-no { font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.batch-card .form-grid, .batch-item .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.batch-item .q-span2 { grid-column: span 2; }
.batch-card .q-field, .batch-item .q-field { margin: 0; }
.batch-card .q-field .field-label, .batch-item .q-field .field-label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.batch-card .q-field .input, .batch-item .q-field .input,
.batch-card .q-field .select, .batch-item .q-field .select { width: 100%; box-sizing: border-box; }
.batch-card .btn-sm, .batch-item + .btn-sm { margin-top: 10px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

