/* 销售看板（交叉表） */

/* ---------- 筛选条 ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.filter-hint {
  flex: 1 0 100%;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: -2px;
}

/* 日期区间选择 */
.date-input {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.date-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, .12);
}
.date-sep { color: var(--text-tertiary); font-size: 12px; }

.quick-range { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active {
  background: var(--primary-soft);
  border-color: rgba(24, 95, 165, .25);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 表格 ---------- */
.table-wrap {
  margin: 16px 20px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 220px);
}

.board-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1560px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.board-table th,
.board-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: right;
}

.board-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f0f3f6;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.35;
  border-bottom: 1px solid #d8dde3;
}

.col-name {
  text-align: left !important;
  min-width: 190px;
  width: 190px;
}
.col-num { min-width: 96px; }

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 var(--border);
}
thead .sticky-col { z-index: 4; background: #f0f3f6; }

/* 行类型 */
.row-group > td {
  background: #f7f9fb;
  font-weight: 600;
  color: var(--text);
}
.row-group .col-name { padding-left: 14px; }

.row-store .col-name {
  padding-left: 30px;
  color: var(--text-secondary);
  font-weight: 400;
}

.row-subtotal > td {
  background: var(--warn-soft);
  font-weight: 600;
  border-top: 1px solid #efe3a8;
}
.row-subtotal .col-name { padding-left: 14px; }

.row-total > td {
  background: #eef4fa;
  font-weight: 700;
  color: var(--text);
  border-top: 2px solid #c9d9ea;
  border-bottom: none;
}
.row-total .col-name { padding-left: 14px; }

.board-table tbody tr:hover > td { background: #f2f7fc; }
.board-table tbody tr.row-subtotal:hover > td { background: #fff3c4; }
.board-table tbody tr.row-total:hover > td { background: #e6eef7; }

/* 数值着色 */
.num-up { color: var(--up); }
.num-down { color: var(--down); }
.num-muted { color: var(--text-tertiary); }
.num-zero { color: #b9c0c8; }

.group-count {
  display: inline-block;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 20px;
  background: #e9edf1;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  line-height: 17px;
  vertical-align: 1px;
}
.group-count.muted { background: transparent; color: #b9c0c8; }

.hint-warn { color: var(--warn); font-weight: 500; }

/* 可录入的销售目标单元格 */
.col-target.editable { cursor: pointer; }
.col-target.editable:hover {
  background: var(--primary-soft) !important;
  box-shadow: inset 0 0 0 1px rgba(24, 95, 165, .35);
  border-radius: 4px;
  color: var(--primary);
}

.rate-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 12px;
  background: #f1f3f5;
  color: var(--text-secondary);
}
.rate-pill.good { background: #e6f4ea; color: #1a7f37; }
.rate-pill.warn { background: #fff4e5; color: #9a6700; }
.rate-pill.bad  { background: #fdecea; color: #d1242f; }

.loading-cell, .empty-cell {
  text-align: center !important;
  color: var(--text-tertiary);
  padding: 40px 0 !important;
}

/* ---------- 页脚 ---------- */
.board-footer {
  padding: 14px 20px 28px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.8;
}
.formula-note {
  margin-top: 4px;
  color: #a3aab3;
}

@media (max-width: 720px) {
  .table-wrap { margin: 12px 10px 0; }
  .filter-bar { padding: 10px 12px; gap: 10px; }
  .filter-hint { margin-left: 0; width: 100%; }
}
