/* ============================================================
   pwk-tbl.css —— 普为康工作台 · 表格可读性增强 v1（2026-11-04）
   三件套：
     1. 0 值灰显 + 数字等宽右对齐
     2. 行高留呼吸 + 极淡斑马纹（半透明叠加，不遮盖告警底色）
     3. 表头吸顶 + 汇总行常驻（表里本来就有 <tfoot> 才生效）
   外加：列宽可拖动（真正冻结在 JS 里，这里只画手柄）

   原则：不含任何业务逻辑；不改字号族；页面自己写过的样式优先；
         删掉这一行 <link> 即完全还原。
   ============================================================ */

/* ---------- 1. 斑马纹 / 悬停 ----------
   只在「没装 pwk.css 皮肤」的页面补——皮肤那 7 个页面本来就有斑马纹，
   再加一层会叠成深色。zebra 用 background-image 半透明叠加：
   直接把 background-color 铺上去会把缺货行/告警行的底色盖掉（踩过）。 */
html:not(.pwk-skin) table > tbody > tr:nth-child(even) > td{
  background-image:linear-gradient(rgba(242,245,250,.92), rgba(242,245,250,.92));
}
html:not(.pwk-skin) table > tbody > tr:hover > td{
  background-image:linear-gradient(rgba(235,241,254,.95), rgba(235,241,254,.95));
}

/* ---------- 2. 行高：给表格一点呼吸 ----------
   用元素选择器（特异性 0,0,3），比裸 td{} 高、比 .xxx td{} 低，
   已经精细调过的表格不受影响。 */
table > tbody > tr > td{ padding-top:7px; padding-bottom:7px; }

/* ---------- 3. 表头吸顶 / 汇总行常驻 ----------
   背景色由 JS 兜底：页面没给 th 设底色时补一个，否则吸顶会透出下面内容。 */
table > thead > tr > th{ position:sticky; top:0; z-index:2; }
table > tfoot > tr > td{ position:sticky; bottom:0; z-index:2; }

/* ---------- 3.5 单元格不折行 ----------
   列宽已经能拖了，再让文字折成两行反而难看、行高也不齐。
   统一单行；真要换行的列自己加 class="pwk-wrap" 或 data-wrap="1"。
   只作用于 JS 认过的数据表（table.pwk-tbl，必须有 <thead>），
   KPI 卡里的迷你表、布局用的 table 不受影响。 */
table.pwk-tbl > tbody > tr > td,
table.pwk-tbl > thead > tr > th{ white-space:nowrap; }
table.pwk-tbl > tbody > tr > td.pwk-wrap,
table.pwk-tbl > tbody > tr > td[data-wrap="1"]{ white-space:normal; }

/* 拖过列宽（表格已冻结成 fixed）之后，把超出的内容裁成省略号，
   否则单行文字会溢出单元格、压到右边那一列上。没拖过时不裁，
   免得误伤弹出菜单之类的东西。 */
table.pwk-fixed > tbody > tr > td{ overflow:hidden; text-overflow:ellipsis; }

/* ---------- 4. 数字三态（由 JS 打标，只有确认是数字才加类） ---------- */
td.pwk-n{ text-align:right; font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1; }
td.pwk-z{ color:#98A2B3; }             /* 0 —— 退到背景里去 */
td.pwk-neg{ color:#D92D20; }           /* 负数 */

/* ---------- 5. 列宽拖拽 ---------- */
th.pwk-gripable{ position:relative; }
.pwk-grip{
  position:absolute; top:0; right:0; width:10px; height:100%;
  cursor:col-resize; z-index:5; touch-action:none;
}
.pwk-grip::after{
  content:""; position:absolute; top:16%; height:68%; right:4px; width:2px; border-radius:1px;
  background:transparent; transition:background .1s;
}
th.pwk-gripable:hover .pwk-grip::after{ background:#AEBBD0; }
th.pwk-gripable.pwk-gripping .pwk-grip::after{ background:#1542FF; }
table.pwk-resizing{ cursor:col-resize; }
table.pwk-resizing td, table.pwk-resizing th{ user-select:none; }

/* ---------- 6. 表头排序 ----------
   只在 JS 判定可排序的列上生效；漏斗已经拿掉（用户 11-05 要求改成表格上方筛选条）。 */
th.pwk-sortable{ cursor:pointer; user-select:none; padding-right:20px !important; }
.pwk-arw{
  position:absolute; right:5px; top:50%; transform:translateY(-50%);
  font-size:11px; line-height:1; color:#98A2B3; opacity:.35;
  pointer-events:none; font-family:system-ui,sans-serif;
}
th.pwk-sorted{ background-image:linear-gradient(rgba(21,66,255,.05), rgba(21,66,255,.05)); }
th.pwk-sorted .pwk-arw{ color:#1542FF; opacity:1; }

/* ---------- 7. 表格上方筛选条（2026-11-05 按用户要求重做） ----------
   形态参照 ERP 查询页：一排「列名 + 输入/下拉」，右下角搜索/重置，
   右侧显示「筛出 N / 共 M 行」。条件之间是「并且」。 */
.pwk-fbar{
  margin:0 0 9px; padding:10px 12px;
  background:#FAFBFD; border:1px solid #E3E8F0; border-radius:8px;
  font-size:12px; line-height:1;
}
.pwk-fbar-cols{ display:flex; flex-wrap:wrap; gap:9px 12px; }
.pwk-fbar-f{ display:flex; align-items:center; gap:5px; margin:0; }
.pwk-fbar-f > span{ color:#667085; white-space:nowrap; }
.pwk-fbar-i{
  height:28px; padding:0 8px; font-size:12px; color:#182B49;
  border:1px solid #D6DCE8; border-radius:5px; background:#fff; outline:none;
  box-sizing:border-box; font-family:inherit;
}
input.pwk-fbar-i{ width:132px; }
select.pwk-fbar-i{ min-width:118px; max-width:190px; cursor:pointer; }
.pwk-fbar-i:focus{ border-color:#1542FF; }
/* 数值列：符号下拉窄一点，≥ 输入更窄（2026-11-10）。两个控件并排但属于同一个筛选条件 */
select.pwk-fbar-i.pwk-num-op{ min-width:74px; max-width:74px; }
input.pwk-fbar-i.pwk-num-min{ width:62px; padding:0 6px; }
input.pwk-fbar-i.pwk-num-min::-webkit-outer-spin-button,
input.pwk-fbar-i.pwk-num-min::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.pwk-fbar-act{
  display:flex; align-items:center; gap:8px; margin-top:10px;
  padding-top:9px; border-top:1px dashed #E3E8F0;
}
.pwk-fbar-b{
  height:28px; padding:0 15px; font-size:12px; cursor:pointer; font-family:inherit;
  border:1px solid #D6DCE8; border-radius:5px; background:#fff; color:#344054;
}
.pwk-fbar-b:hover{ border-color:#1542FF; color:#1542FF; }
.pwk-fbar-b.pwk-go{ background:#1542FF; border-color:#1542FF; color:#fff; }
.pwk-fbar-b.pwk-go:hover{ background:#0F35D0; color:#fff; }
.pwk-fbar-tip{ margin-left:auto; color:#98A2B3; }
.pwk-fbar-tip.pwk-on{ color:#1542FF; font-weight:600; }

/* 打印：手柄/箭头不该出现；纸上没有横向滚动，恢复折行免得内容被裁掉 */
@media print{
  .pwk-grip, .pwk-arw{ display:none !important; }
  table.pwk-tbl > tbody > tr > td,
  table.pwk-tbl > thead > tr > th{ white-space:normal; }
}

