.cost-ant-table-wrapper {
  border-radius: 4px !important;

  table {
    border-radius: 4px !important;
  }

  .cost-ant-table-container {
    border-start-start-radius: 4px !important;
    border-start-end-radius: 4px !important;
  }

  // 移除空规则，避免linter警告
}

.cost-ant-table .cost-ant-table-header {
  border-radius: 4px !important;
}

.cost-ant-pro-table .cost-ant-pro-card .cost-ant-pro-card-body {
  padding-inline: 0 !important;
}

.cost-ant-table-thead > tr > th {
  padding: 8px 8px !important;
  background: #eef3fa !important;

  &::before {
    display: none !important;
  }
}

.cost-ant-table-wrapper .cost-ant-table-pagination.cost-ant-pagination {
  padding-right: 16px;
}

.cost-ant-table-wrapper
  .cost-ant-table.cost-ant-table-bordered
  > .cost-ant-table-container
  > .cost-ant-table-body
  > table
  > tbody
  > tr
  > td {
  //#dae2f2
  border-inline-end: 1px solid #dae2f2 !important;
}

.KCIMTable {
  .cost-ant-table {
    .cost-ant-space-align-center {
      gap: 0 !important;
    }

    .cost-ant-table-thead {
      .cost-ant-table-cell {
        padding: 8px 8px !important;
        background: rgb(238 243 250 / 100%) !important;
        // 表头允许换行
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere;
        // 多层级表头边框
        border-bottom: 1px solid #dae2f2 !important;
        border-right: 1px solid #dae2f2 !important;
      }
      // 首列左边框
      > tr > th:first-child {
        border-left: 1px solid #dae2f2 !important;
      }

      a {
        color: #3376fe;
      }

      .cost-ant-table-selection {
        .cost-ant-table-selection-extra {
          top: 5px;
        }
      }

      &::before {
        display: none;
      }

      &:hover {
        background: rgb(238 243 250 / 100%) !important;
      }

      // 不再去掉最后一个表头格子的右边框，保持分隔
    }

    .cost-ant-table-tbody {
      & > tr {
        &.cost-ant-table-measure-row {
          border: none !important;
          & > td {
            border-inline-end: none !important;
          }
        }

        &.cost-ant-table-row {
          .cost-ant-table-cell {
            font-size: 14px;
            font-family: SourceHanSansCN-Medium, SourceHanSansCN;
            justify-content: flex-start !important;
            color: #17181a;
            padding: 8px 8px !important;
            border-bottom: none !important;
            border-top: 1px solid rgb(218 226 242) !important;

            &.cost-ant-table-cell-with-append {
              .cost-ant-table-row-expand-icon {
                border-radius: 4px !important;
                border: 1px solid #dae2f2 !important;

                &:hover {
                  color: #3377ff;
                  border: 1px solid #3377ff !important;
                }
              }
            }

            & > .cost-ant-typography {
              line-height: unset;
            }

            // 移除空规则，避免linter警告

            // &:hover {
            //     border-radius: 0 !important;
            //     background: #FAFBFC !important;

            // }
          }
        }

        &.cost-ant-table-row-selected {
          .cost-ant-table-cell {
            border-radius: 0 !important;
          }
          &:hover {
            background: #bae0ff !important;
          }
        }

        &:last-child > td {
          border-bottom: none !important;
        }
      }
    }

    .cost-ant-table-summary {
      & > tr > td {
        // 不强制对齐，让各列按照 Summary.Cell 的 align 与列配置对齐
        padding: 8px 8px !important; // 与tbody行保持一致高度
        border-top: 1px solid #dae2f2 !important;
      }
    }

    &.cost-ant-table-bordered {
      .cost-ant-table-container {
        border-left: none !important;
        .cost-ant-table-thead {
          & > tr {
            & > th {
              border-right: 1px solid #dae2f2 !important;
              border-bottom: 1px solid #dae2f2 !important;
              border-top: none !important;

              &.cost-ant-table-cell-scrollbar {
                border: none !important;
              }

              &::after {
                border: none !important;
              }
            }

            &:last-child {
              & > th {
                border-top: none !important;
              }
            }
          }
        }
        .cost-ant-table-tbody {
          tr > td {
            border-right: 1px solid #dae2f2 !important;
            &::after {
              border: none !important;
            }
          }
        }
      }
    }
  }
  .cost-ant-pagination {
    padding: 7px 0;
    margin: 0 !important;
    border-top: 1px solid #dae2f2 !important;

    .cost-ant-pagination-item-active {
      font-weight: 600;
      background-color: #37f !important;
      border-color: #37f !important;
    }
  }

  .cost-ant-pagination .cost-ant-pagination-item-active a {
    color: #fff !important;
  }
}

.cost-ant-table-wrapper
  .cost-ant-table-container
  table
  > thead
  > tr:first-child
  th:first-child {
  border-start-start-radius: 4px !important;
}

.cost-ant-table-wrapper
  .cost-ant-table-container
  table
  > thead
  > tr:first-child
  th:last-child {
  border-start-end-radius: 4px !important;
}

.cost-ant-empty-normal {
  margin-block: 80px !important;
  color: rgb(0 0 0 / 25%);
}

// 小计行高亮背景样式
.subtotal-row {
  background: #f2f8ff !important;
  font-weight: 600; // 小计行加粗
}

// 兼容固定列：为固定列的单元格也着色
.KCIMTable {
  .cost-ant-table {
    .cost-ant-table-tbody {
      tr.subtotal-row > td,
      tr.subtotal-row > td.cost-ant-table-cell-fix-left,
      tr.subtotal-row > td.cost-ant-table-cell-fix-right,
      tr.subtotal-row > td.cost-ant-table-cell-fix-left-last,
      tr.subtotal-row > td.cost-ant-table-cell-fix-right-first {
        background: #f2f8ff !important;
        position: relative;
        font-weight: 600; // 与整行一致加粗
      }
      // 去掉固定列的阴影遮罩，避免覆盖行背景
      tr.subtotal-row > td.cost-ant-table-cell-fix-left::after,
      tr.subtotal-row > td.cost-ant-table-cell-fix-left-last::after,
      tr.subtotal-row > td.cost-ant-table-cell-fix-right::after,
      tr.subtotal-row > td.cost-ant-table-cell-fix-right-first::after {
        box-shadow: none !important;
        background: transparent !important;
      }
    }
  }
}
