/* ============================================================
   cost.css —— 成本表（独立栏目）
   ------------------------------------------------------------
   这张表是全站的价格真源：定价页算成本、组合装拼成本、总览看利润，
   取的都是 PT.data.costOf() 的值。所以这一页的排版目标很单纯 ——
   让人一眼扫完 17 行、一眼看出哪几个数被改过。

   形状照着用户手里那张 Excel 来：一行一款、HB / 2B 两列。
   models.js 里 HB 和 2B 是两条独立记录（costOf() 按全名查，拆不得），
   这里只是在显示时把两条配回一行 —— 显示像表格，存储还是两条。

   颜色全走 design token，浅色 / 深色自动跟随，这里不写任何硬编码色值，
   也不写 html[data-theme] 分支。

   ⚠️ 一条踩过的坑（写之前先看）：
   components.css 里有
       input[type="text"], input[type="number"], select, textarea { width: 100%; }
   它的特异性是 (0,1,1)。只写 `.cost-in { width: 88px }` 是 (0,1,0)，
   **压不过它** —— 输入框会撑满整格，把表格顶变形。
   必须写成 `input[type="number"].cost-in`（(0,2,1)）才赢。
   这跟之前 .gc-qty / .dim-in 是同一个坑：样式不是没写对，是被更具体的一条压住了。
   ============================================================ */

/* ---------- 顶部引导 ---------- */

.note.cost-lead { margin-bottom: 14px; }

/* ---------- 工具条：计数 + 全部恢复默认 ---------- */

.cost-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}
.cost-bar .btn { margin-left: auto; }

.cost-count {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
/* 有改动的时候把它点亮 —— 这是这一页唯一需要「一眼看到」的状态 */
.cost-count.on {
  color: var(--warn);
  font-weight: 600;
}

/* ---------- 分区 ---------- */

.cost-body { margin-top: 4px; }

.cost-sec + .cost-sec { margin-top: 20px; }

.cost-sec-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-bottom: 7px;
  padding-left: 2px;
}
.cost-sec-head b { font-size: 13px; color: var(--text); }
.cost-sec-unit {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
/* 说明推到最右 —— 它是注解，不该和标题抢注意力 */
.cost-sec-note {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
}

/* ---------- 表格 ----------
   列宽固定，让三张表的 HB / 2B 输入框纵向对齐 ——
   对齐之后一眼就能扫出哪一行贵。 */

.cost-table { min-width: 560px; }
.cost-table.no-variant { min-width: 440px; }

/* 一页里三张表叠着，sticky 表头在 overflow 容器里行为不可靠，
   干脆固定住：表不长（8 行），静态表头更好预测。 */
.cost-table th { position: static; }

.cost-table td.cost-name {
  min-width: 150px;
  font-size: 12.5px;
}
.cost-table td.cost-name b { font-weight: 600; color: var(--text); }

/* IP 削笔器的热度保质期：挂在名字下面一行小字 */
.cost-heat {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--warn);
  white-space: nowrap;
}

.cost-table .cost-price  { width: 104px; text-align: center; }
.cost-table .cost-weight { width: 92px;  text-align: center; }
.cost-table .cost-status { width: 128px; text-align: center; }
.cost-table .cost-op     { width: 46px;  text-align: center; }

/* ---------- 输入框 ----------
   注意上面那条坑：这里的选择器必须带 input[type="number"] 前缀。 */

input[type="number"].cost-in {
  width: 88px;
  height: 30px;
  padding: 0 7px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
  text-align: right;
  font-weight: 600;
}
input[type="number"].cost-w-in { width: 72px; }

/* 改过的值：琥珀色。不用红色 —— 改价是正常操作，不是错误。 */
input[type="number"].cost-in.is-changed {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

/* 配件 / IP 段只有一个价格列，让它占满「HB + 2B」那两列的宽度，
   并右对齐 —— 这样三张表的毛重 / 状态 / ↺ 三列纵向对齐，
   价格框的右边缘也跟 2B 框对齐。不这么做的话，
   配件表的数字会孤零零飘在中间，跟上面的铅笔表对不上。 */
.cost-table.no-variant .cost-price {
  width: 208px;      /* = 104 (HB) + 104 (2B) */
  text-align: right;
}
/* 表头跟着右对齐，不然「价格」两个字会飘在列中间 */
.cost-table.no-variant th.cost-price-h { text-align: right; }

/* 某个变体不存在（比如只有 HB 没有 2B）时的占位 */
.cost-na { color: var(--text-3); }

/* ---------- 状态列 ---------- */

.cost-ok {
  font-size: 11px;
  color: var(--text-3);
}

.cost-changed {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: 20px;
  white-space: nowrap;
}

/* 「改了哪一项」的小标签：HB / 2B / 毛重 */
.cost-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 10.5px;
  color: var(--text-3);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  white-space: nowrap;
}

/* ---------- 单行恢复 ---------- */

.cost-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.cost-reset:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border-2);
}
.cost-reset:disabled { opacity: .35; cursor: default; }

/* ---------- 窄屏 ----------
   表格本身给了 min-width，.table-wrap 会横向滚动 ——
   比把 6 列挤成一团可读。这里只把分区说明挪回下一行。 */

@media (max-width: 760px) {
  .cost-sec-note { margin-left: 0; flex-basis: 100%; }
}
