/* cutlist — tool-specific styles
   只放这个工具独有的东西。公共外观（toolbox / field / alert / chip / hint）
   已经在全局样式表里。

   ★ 不写任何裸色值：一律走主题变量（--surface / --line / --fg …）。
   ★ 类名前缀 .cl- 是本工具私有的 —— 借别的工具的类名 = 没有样式
     （工具样式按工具隔离加载）。 */

/* 分类横幅：`分类名 · 说明` 两段拼的（验收脚本会单独比对后半句） */
.cl-status {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  color: var(--fg-muted);
}

/* ── 板材参数行 ──
   ★ 不用全局的 .toolbox__controls：那套是 `grid-template-columns: 1fr 240px`，
     只适合"两个字段一行"。这里第一行三列、第二行两列，塞进两列栅格会错位。
     auto-fit 让它自己决定列数。 */
.cl-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.cl-row + .cl-row {
  margin-top: 14px;
}

/* 标签 + 单位符号。★ 单位符号**不能**放进 .field__label 里面：
   验收脚本读 .field__label 的 textContent 去比对语言包，
   "Sheet width in" 不等于语言包里的任何一条 ⇒ 必然假红。 */
.cl-lab {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 6px;
}

.cl-lab .field__label {
  margin-bottom: 0;
}

.cl-unit {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--fg-muted);
}

/* ═══════════════════════════════════════════════════════════
   零件清单
   ═══════════════════════════════════════════════════════════ */

.cl-parts {
  margin-top: 16px;
}

/* ★ 表头与数据行**共用同一套列宽**：写两遍就会各改各的，
   最后表头和数据错位一列 —— 而那看着像"输入框没对齐"的小毛病，
   实际是"你往 Width 里填的东西进了 Height"。所以只写一处。 */
.cl-parts__head,
.cl-part {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 92px 92px 72px 52px 34px;
  gap: 8px;
  align-items: center;
}

.cl-parts__head {
  padding: 0 0 6px;
}

.cl-parts__head .field__label {
  margin-bottom: 0;
}

/* 第 5、6 列（旋转开关 / 删除按钮）的表头没有字 —— 但它仍占位，
   否则后面两个字会左移，与数据行的复选框错开。 */

.cl-part + .cl-part {
  margin-top: 8px;
}

.cl-part .cl-txt {
  min-width: 0;
}

.cl-check {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.cl-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.cl-del {
  padding: 2px 0;
  line-height: 1;
  font-size: 15px;
  color: var(--fg-muted);
}

.cl-addrow {
  margin-top: 10px;
}

@media (max-width: 560px) {
  .cl-parts__head {
    display: none;
  }

  .cl-part {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 52px 34px;
    row-gap: 6px;
  }
}

/* ═══════════════════════════════════════════════════════════
   结果：主读数 + 四格
   ═══════════════════════════════════════════════════════════ */

.cl-lead {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cl-lead__k {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
}

.cl-lead__v {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--fg);
}

.cl-lead__x {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.cl-cell {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cl-cell__k {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
}

.cl-cell__v {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg);
  word-break: break-word;
}

.cl-cell__u {
  margin-left: 5px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--fg-muted);
}

.cl-cell__x {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--fg-muted);
  word-break: break-word;
}

/* ── 排不下的零件 ── */
.cl-unplaced {
  margin-top: 12px;
}

.cl-unplaced__list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

.cl-unplaced__list li + li {
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   排布图
   ═══════════════════════════════════════════════════════════ */

.cl-figs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.cl-fig {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cl-fig__cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--fg-muted);
}

.cl-fig__util {
  font-weight: 600;
  color: var(--fg);
}

.cl-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  margin: 0 auto;
}

/* 板材底板：与卡片同色但描边清楚，否则"板"和"卡片"分不出来 */
.cl-sheetbg {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}

/* 零件块。★ 8 色循环，对应 ui.js 里的 PALETTE ——
   相邻的零件是同一个 `partId` 时颜色相同，一眼能把"这一堆是同一张零件的第几件"认出来。 */
.cl-piece rect {
  stroke-width: 1;
}

.cl-piece text {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
}

.cl-piece--0 rect { fill: #d7e7fb; stroke: #4b83c8; }
.cl-piece--0 text { fill: #14406f; }
.cl-piece--1 rect { fill: #d9f0dd; stroke: #4f9a68; }
.cl-piece--1 text { fill: #1b5e34; }
.cl-piece--2 rect { fill: #fbe6cf; stroke: #c08a4a; }
.cl-piece--2 text { fill: #7a4a12; }
.cl-piece--3 rect { fill: #e8dcf7; stroke: #8a6cc0; }
.cl-piece--3 text { fill: #4b2d78; }
.cl-piece--4 rect { fill: #fbdce4; stroke: #c8697f; }
.cl-piece--4 text { fill: #7a1f38; }
.cl-piece--5 rect { fill: #d5eef2; stroke: #4f9aa8; }
.cl-piece--5 text { fill: #14515c; }
.cl-piece--6 rect { fill: #ececd0; stroke: #a8a84a; }
.cl-piece--6 text { fill: #5c5c14; }
.cl-piece--7 rect { fill: #e2e5ea; stroke: #8d95a0; }
.cl-piece--7 text { fill: #333a44; }

/* 深色主题：底色压深、文字提亮。★ 不重算的话白底浅字会全糊在一起 ——
   而"图整体变浅"很容易被当成主题没生效顺手忽略。 */
html[data-theme='dark'] .cl-piece--0 rect { fill: rgba(75, 131, 200, 0.30); stroke: #7fa9dd; }
html[data-theme='dark'] .cl-piece--0 text { fill: #cfe0f7; }
html[data-theme='dark'] .cl-piece--1 rect { fill: rgba(79, 154, 104, 0.30); stroke: #7dbd92; }
html[data-theme='dark'] .cl-piece--1 text { fill: #cfeeda; }
html[data-theme='dark'] .cl-piece--2 rect { fill: rgba(192, 138, 74, 0.30); stroke: #d3a877; }
html[data-theme='dark'] .cl-piece--2 text { fill: #f6e0c4; }
html[data-theme='dark'] .cl-piece--3 rect { fill: rgba(138, 108, 192, 0.30); stroke: #b199dd; }
html[data-theme='dark'] .cl-piece--3 text { fill: #e2d6f7; }
html[data-theme='dark'] .cl-piece--4 rect { fill: rgba(200, 105, 127, 0.30); stroke: #dd9aac; }
html[data-theme='dark'] .cl-piece--4 text { fill: #f8d6de; }
html[data-theme='dark'] .cl-piece--5 rect { fill: rgba(79, 154, 168, 0.30); stroke: #7dbcc7; }
html[data-theme='dark'] .cl-piece--5 text { fill: #cfeaef; }
html[data-theme='dark'] .cl-piece--6 rect { fill: rgba(168, 168, 74, 0.28); stroke: #c7c784; }
html[data-theme='dark'] .cl-piece--6 text { fill: #eeeecf; }
html[data-theme='dark'] .cl-piece--7 rect { fill: rgba(141, 149, 160, 0.30); stroke: #a8b0bb; }
html[data-theme='dark'] .cl-piece--7 text { fill: #dde2e8; }
