/* tablekit.css — 标准表格组件样式（与 tablekit.js 配套，所有表格页统一引用） */

.tkwrap { margin-bottom: 8px; }
.tk-tools { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.tk-cnt { margin-right: auto; font-size: 12.5px; color: var(--text3, #8f959e); }
.tk-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line, #e6e8eb);
  background: #fff; color: var(--text2, #646a73); font: inherit; font-size: 12.5px; cursor: pointer; }
.tk-btn:hover { border-color: #c8ccd2; color: var(--text, #1f2329); }

.tk-panel { margin-top: 8px; background: #fff; border: 1px solid var(--line, #e6e8eb);
  border-radius: 6px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.tk-panel-h { width: 100%; font-size: 12px; color: var(--text3, #8f959e); margin-bottom: 2px; }
.tk-ck { font-size: 12.5px; color: var(--text2, #646a73); display: inline-flex; gap: 5px;
  align-items: center; cursor: pointer; white-space: nowrap; }
.tk-panel-f { width: 100%; margin-top: 4px; display: flex; gap: 14px; }
.tk-panel-f a { color: var(--blue, #0077fa); font-size: 12.5px; cursor: pointer; }

/* 容器：横向滚动（拖宽超出时不被压回）+ 纵向滚动
   🔴 纵向必须「能滚且高度有界」，否则表头吸顶是假的（2026-10-22 实测踩坑）：
      · CSS 规定：overflow-x:auto 时，overflow-y:visible 会被**计算成 auto**，
        所以 .tk-scroll 无论如何都是滚动容器；
      · 若不给它高度上限，它就永不纵向滚动（scrollHeight == clientHeight），
        于是 thead 的 position:sticky 绑死在这个「不滚的容器」上 ——
        整页（.main）滚动时表头跟着一起走、根本钉不住。
        biz.html 实测：滚 .main 后表头 top 由 255 跑到 -145（已滚出屏幕）。
      · 给了 max-height，列表在自己框内滚，表头（含筛选行 top:34px）才真钉住。
      短列表不会溢出，自然不出现滚动条。高度可用 --tk-maxh 按页覆盖。 */
.tk-scroll { overflow-x: auto; overflow-y: auto;
  max-height: var(--tk-maxh, calc(100vh - 300px)); }

/* 表格本体：固定布局是拖宽生效的前提
   🔴 overflow 必须 visible（2026-10-22 二踩）：
      有的页面自带 `table{...overflow:hidden}`（拿它裁圆角），而 hidden **也会创建滚动容器**，
      于是 thead 的 position:sticky 会绑到「表格自己」而不是外层 .tk-scroll —— 表格不滚，
      表头就钉不住（loopdetail 实测 tblOverflow=hidden）。优先级 .tk-table(0,1,0) > table(0,0,1)，
      这里显式 visible 覆盖掉页面规则。圆角改由表头两角自己画（见下）。 */
.tk-table { table-layout: fixed; width: auto; border-collapse: separate; border-spacing: 0;
  background: #fff; border: 1px solid var(--line, #e6e8eb); border-radius: 6px;
  overflow: visible; }
.tk-table thead th { position: sticky; top: 0; z-index: 3; background: #fafbfc;
  color: var(--text2, #646a73); font-weight: 500; font-size: 12.5px; text-align: left;
  padding: 0; border-bottom: 1px solid var(--line, #e6e8eb); }
/* 表格不再 overflow:hidden 裁圆角，改由表头两上角自己画（否则方形表头背景溢出圆角） */
.tk-table thead th:first-child { border-top-left-radius: 5px; }
.tk-table thead th:last-child { border-top-right-radius: 5px; }
.tk-table thead tr.tk-filter-row td { position: sticky; top: 34px; z-index: 2;
  background: #fafbfc; padding: 3px 6px; border-bottom: 1px solid var(--line, #e6e8eb); }
.tk-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line2, #eef0f2);
  vertical-align: top; overflow: hidden; word-break: break-word; }
.tk-table tbody tr:last-child td { border-bottom: none; }
.tk-table tbody tr:hover td { background: #fafcff; }

/* 列头：可拖动排序 */
.fcl { cursor: grab; user-select: none; padding: 9px 10px; display: flex; align-items: center;
  gap: 4px; height: 34px; box-sizing: border-box; }
.fcl:active { cursor: grabbing; }
.tk-tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 点列头排序（2026-11-02 补 · 表格 11 条标准第 9 条）
   —— 只有列定义里给了 sortKey 的列可排，标题右侧显示双向箭头 ⇅，
      当前排序列显 ▲（升）/ ▼（降）并把标题染蓝加粗。
   ⚠️ 排序是**行排序**，与「拖动表头换列顺序」是两件事：
      拖动 = 改列的左右位置（tk.order）；点标题 = 改行的先后（tk.sort）。 */
.fcth.cansort .fcl { cursor: pointer; }
.fcth.cansort .fcl:hover { background: #f2f6ff; }
.fcth.sorted .fcl { color: #3b5bff; font-weight: 600; }
/* 排序符号 ⇅ 必须浮在筛选三角 .tri 的透明热区(::before z-index:3)之上，
   否则点 ⇅ 命中的是 tri 热区 → 弹筛选面板而非排序（点了没反应的元凶之一）。
   2026-11-23 修：给 srt 相对定位 + z-index:4，点 ⇅ 正常触发列头排序。 */
.fcth .srt { font-size: 10px; color: #a9afb8; flex: none; line-height: 1;
  position: relative; z-index: 4; }
.fcth.sorted .srt { color: #3b5bff; }
/* 列头小三角：常显、可点（点击弹「筛选条件」面板）；该列有筛选时变蓝。
   2026-10-18 前是 opacity:0 藏着、只当"已筛选"指示灯——钱江要跟拍照列表
   一样能点出筛选条件，改成常显入口（records.html 的同款交互）。
   2026-10-18 深夜：钱江反馈「鼠标到三角的地方才变成手，三角又太小很难选到」
   ——CSS 空心三角命中区只有约 8×5px。用 ::before 透明热区把命中区扩到约
   32×24px（视觉大小不变），z-index:3 低于列宽把手 .grip 的 4——列右缘 7px
   仍归调列宽，两者不打架；悬停列头任意位置时未筛选列的三角加深+淡蓝底，
   不用精确瞄准就能发现这一列可点。
   ⚠️ inset 必须补偿 border 宽：定位包含块是 padding box（比 border box 内缩
   左右 5px、上 6px），直接写 -11/-9 实际只外扩左右 6px、上 3px（2026-10-18
   验收抓到的）。-16/-15/-9 = 视觉三角外对称扩 11px/9px。 */
.tri { position: relative; width: 0; height: 0; flex: none; margin-left: 2px;
  cursor: pointer; border-left: 5px solid transparent;
  border-right: 5px solid transparent; border-top: 6px solid #a9afb8;
  transition: border-color .15s; }
.tri::before { content: ''; position: absolute; left: -16px; right: -16px;
  top: -15px; bottom: -9px; border-radius: 4px; z-index: 3;
  transition: background .15s; }
.tri:hover { border-top-color: var(--blue, #0077fa); }
/* 悬停列头（未筛选列）：三角加深 + 淡蓝底，扫视即知可点 */
.fcth:not(.ft-on):hover .tri { border-top-color: #6b7280; }
.fcth:not(.ft-on):hover .tri::before { background: rgba(0, 119, 250, .10); }
.fcth:hover .tri:hover { border-top-color: var(--blue, #0077fa); }
/* 已筛选列（ft-on）的蓝色不被 hover 覆盖：筛选状态不能因鼠标移过而"消失" */
th.ft-on .tri { border-top-color: var(--blue, #0077fa); }
th.ft-on .fcl { color: var(--blue, #0077fa); }
th.dragging { opacity: .4; }
th.dropL { box-shadow: inset 3px 0 0 var(--blue, #0077fa); }
th.dropR { box-shadow: inset -3px 0 0 var(--blue, #0077fa); }

/* 列宽拖拽把手 */
.grip { position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize;
  z-index: 4; }
.grip:hover, th.resizing .grip { background: rgba(0, 119, 250, .32); }
th.fcth { position: sticky; }         /* 与 .tk-table thead th 的 sticky 叠加 */

/* 每列筛选输入 */
.fcin { width: 100%; box-sizing: border-box; border: 1px solid var(--line, #e6e8eb);
  border-radius: 4px; padding: 2px 6px; font: inherit; font-size: 12px; height: 24px;
  background: #fff; color: var(--text, #1f2329); }
.fcin:focus { outline: none; border-color: var(--blue, #0077fa); }

.tk-empty td { text-align: center; padding: 26px 10px !important; }

/* 筛选条件面板（列头小三角点出，挂 body 上定位，避开容器 overflow 裁剪） */
.tk-fp { position: fixed; z-index: 1000; display: none; width: 236px;
  background: #fff; border: 1px solid var(--line, #e6e8eb); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12); padding: 10px 12px; }
.tk-fp.on { display: block; }
.tk-fp-t { font-size: 12px; color: var(--text3, #8f959e); margin-bottom: 8px; }
.tk-fp-r { display: flex; gap: 6px; }
.tk-fp-op { flex: none; width: 98px; height: 28px; border: 1px solid var(--line, #e6e8eb);
  border-radius: 4px; font: inherit; font-size: 12px; padding: 0 4px; background: #fff;
  color: var(--text, #1f2329); }
.tk-fp-v { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--line, #e6e8eb);
  border-radius: 4px; font: inherit; font-size: 12px; padding: 0 6px; background: #fff;
  color: var(--text, #1f2329); }
.tk-fp-op:focus, .tk-fp-v:focus { outline: none; border-color: var(--blue, #0077fa); }
.tk-fp-b { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }
.tk-fp-b button { padding: 4px 12px; border-radius: 6px; font: inherit; font-size: 12px;
  cursor: pointer; border: 1px solid var(--line, #e6e8eb); background: #fff;
  color: var(--text2, #646a73); }
.tk-fp-ok { border-color: var(--blue, #0077fa) !important; color: var(--blue, #0077fa) !important; }
.tk-fp-b button:hover { border-color: #c8ccd2; }
