/* ============================================================
   tables.css — 表格系统
   数据表格、漏斗表格
   ============================================================ */

/* 数据表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-base);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border: none;
}

.data-table tbody tr {
  transition: var(--tr);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* 可编辑行 */
tr.editable:hover {
  background: var(--primary-light-2);
}

tr.editable td {
  background: var(--bg);
}

/* ============================================================
   漏斗表格
   ============================================================ */
.funnel-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.funnel-table thead {
  background: var(--bg-input);
}

.funnel-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.funnel-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.funnel-table tbody tr:hover {
  background: var(--primary-light-2);
}

.funnel-table tbody tr:last-child td {
  border-bottom: none;
}

/* 客户信息单元格 */
.funnel-customer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.funnel-customer-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text-inverse);
  flex-shrink: 0;
}

.funnel-customer-avatar.avt-blue   { background: linear-gradient(135deg, #1a73e8, #4285f4); }
.funnel-customer-avatar.avt-orange { background: linear-gradient(135deg, #ff6b35, #ff9a76); }
.funnel-customer-avatar.avt-gold   { background: linear-gradient(135deg, #f4b942, #ffd166); }
.funnel-customer-avatar.avt-green  { background: linear-gradient(135deg, #34a853, #5fca7d); }
.funnel-customer-avatar.avt-gray   { background: linear-gradient(135deg, #8b949e, #adb5bd); }

.funnel-customer-name {
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 2px;
}

.funnel-customer-phone {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

/* 阶段标签 */
.funnel-stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.funnel-stage-tag.tag-intention  { background: var(--primary-light);  color: var(--primary); }
.funnel-stage-tag.tag-following  { background: var(--orange-light);  color: var(--orange); }
.funnel-stage-tag.tag-offer      { background: var(--gold-light);    color: #c77d00; }
.funnel-stage-tag.tag-signed     { background: var(--success-light); color: var(--success); }
.funnel-stage-tag.tag-ended      { background: rgba(139,148,158,0.12); color: #8b949e; }

.funnel-amount {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--success);
}

/* 表格操作列 */
.funnel-table .actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-start;
  align-items: center;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.act-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  transition: var(--tr);
  font-family: inherit;
}

.act-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.act-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* 阶段筛选 Tab */
.funnel-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
}

.funnel-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: var(--tr);
  background: none;
  border: 1px solid transparent;
  color: var(--text-2);
  font-family: inherit;
}

.funnel-tab:hover {
  background: var(--bg-input);
}

.funnel-tab.active {
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: var(--fw-medium);
}

.funnel-tab .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: var(--fs-xs);
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.2);
}

.funnel-tab:not(.active) .count {
  background: var(--bg-input);
}

/* 空状态 */
.funnel-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}

.funnel-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
  opacity: 0.4;
}

/* 编辑框样式 */
.fu-edit-select:focus,
.fu-edit-textarea:focus,
.fu-edit-date:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-border);
}

.fu-edit-textarea {
  line-height: 1.4;
}