/* ============================================================
   全站表格统一规范（v20261125a）
   1) 表头与单元格默认居中；
   2) 需要时可在 th / td（后台为 .ant-table-cell）上加 .ta-l / .ta-r / .ta-c
      手动把某一列改为左对齐 / 右对齐 / 居中（由后台「数据显示」下发）；
   3) 列数较少（≤6 列）的表格由 table-standard.js 添加 .lc-fit / .lc-tbl-fit，
      宽度按内容自适应，不强行铺满；列多或固定列宽的表格保持原样。
   4) 表头工具仅保留：排序（点击表头）与筛选（⌄）；对齐 / 拖拽列宽已移除。
   ============================================================ */

/* ---------- 1. 默认居中 ---------- */
table th,
table td {
  text-align: center !important;
}

.ant-table-wrapper .ant-table-thead > tr > th,
.ant-table-wrapper .ant-table-tbody > tr > td,
.ant-table-wrapper .ant-table-tbody > tr > th,
.ant-table-wrapper .ant-table-summary > tr > td,
.ant-table-wrapper .ant-table-summary > tr > th {
  text-align: center !important;
}

/* ---------- 2. 列级手动对齐（优先级高于默认居中） ---------- */
table th.ta-l,
table td.ta-l { text-align: left !important; }
table th.ta-r,
table td.ta-r { text-align: right !important; }
table th.ta-c,
table td.ta-c { text-align: center !important; }

.ant-table-wrapper .ant-table-cell.ta-l { text-align: left !important; }
.ant-table-wrapper .ant-table-cell.ta-r { text-align: right !important; }
.ant-table-wrapper .ant-table-cell.ta-c { text-align: center !important; }

/* ---------- 3. 少列自适应宽度 ---------- */
/* 静态页表格：宽度随内容收紧，列宽按内容重新计算 */
table.lc-fit {
  width: auto !important;
  table-layout: auto !important;
  max-width: 100%;
}

/* Ant Design 表格：仅收紧表格本体，容器与分页保持原布局 */
.ant-table-wrapper.lc-tbl-fit .ant-table table {
  width: auto !important;
}

/* ============================================================
   4. 原生表格列工具：筛选 / 排序
   ============================================================ */
table.lc-smart th {
  position: relative;
  cursor: pointer;
  overflow: visible;
}

table.lc-smart th .lc-th-tools {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
  /* 只有按钮本身接收鼠标事件，空白处点击仍可触发整列排序 */
  pointer-events: none;
}

table.lc-smart .lc-th-btn {
  pointer-events: auto;
}

table.lc-smart th:hover .lc-th-tools {
  opacity: 1;
}

table.lc-smart .lc-th-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  font-size: 11px;
  line-height: 1;
  color: #64748b;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
}

table.lc-smart .lc-th-btn:hover {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

table.lc-smart th.lc-filtered .lc-th-btn:first-child {
  color: #0284c7;
  font-weight: 700;
}

table.lc-smart .lc-sort-ind {
  font-size: 9px;
  margin-left: 3px;
  color: #0284c7;
}

/* 浮层：筛选输入 */
#lc-table-menu {
  position: fixed;
  display: none;
  z-index: 99999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 8px;
  font-size: 13px;
  color: #334155;
  min-width: 150px;
}

#lc-table-menu .lc-menu-title {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#lc-table-menu .lc-menu-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
}

#lc-table-menu .lc-menu-input:focus {
  border-color: #0284c7;
}

#lc-table-menu .lc-menu-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

#lc-table-menu .lc-menu-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}

#lc-table-menu .lc-menu-btn:hover {
  border-color: #94a3b8;
}

#lc-table-menu .lc-menu-btn.lc-primary {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

/* 保存表格设置（页面级浮动按钮） */
#lc-table-save {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
  transition: background 0.15s ease;
}

#lc-table-save:hover {
  background: #0369a1;
}

