/* web/static/css/spine.css - 交接清单脊柱视觉层 (五站 + 折叠 rail + 站体控件)
 *
 * INPUT:  spine.templ / stations.templ 的 class 与 id (#spine .station* .facts* .fixes .fix* .checks* .rail-count).
 * OUTPUT: 脊柱 296px / rail 76px、站编号圆与连线、Interpret 事实表、Diagnose 九项清单、Propose 修复卡.
 * POS:    web/static/css - 纯样式; 由 cellsmith.css 的 token (:root) 供色, layout.templ 在其后加载.
 * PROTOCOL:
 *   - 调色板与密度来自 direction-2/style.css (docs/design/handoff-checklist-plan.md §2/§8 batch 2).
 *   - 从 cellsmith.css 拆出 (plan §10: 800 行上限), 拆分本身零视觉变化.
 *   - 变更时更新本头; class 增删同步 spine.templ / stations.templ.
 */

/* ---- spine: 五站交接清单 ---- */
.spine {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--paper);
  border-right: 1px solid var(--rule-2);
  padding: 10px 0 18px;
}

.spine__head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 10px 18px; }

.spine__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: nowrap;
}

.spine__toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.spine__toggle:hover { background: var(--surface-hover); }
.spine__toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.spine__stations { list-style: none; margin: 0; padding: 0; }
.station { position: relative; padding: 0 16px 18px 60px; }

/* 站与站之间的竖向连线 */
.station::before {
  content: "";
  position: absolute;
  left: 31px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--rule-2);
}

.station:last-child::before { display: none; }

.station__num {
  position: absolute;
  left: 16px;
  top: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--rule-2);
  border-radius: 50%;
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
  color: var(--mute);
}

.station--cur .station__num { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.station--att .station__num { background: var(--ochre-bg); border-color: var(--ochre); color: var(--ochre); }
.station--on .station__num { border-color: var(--ink); color: var(--ink); }
.station--done .station__num { background: var(--green); border-color: var(--green); color: #FFFFFF; }
.station--warn .station__num { background: var(--verm-bg); border-color: var(--verm); color: var(--verm); }

.station__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 32px;
  color: var(--ink);
}

/* 站计数 ("1 guess" / "5/9" / "3 fixes" / "idle" / "3 unsaved"): 标题行右侧; rail 里换到站名下. */
.station__count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.station--att .station__count { color: var(--ochre); }
.station--warn .station__count { color: var(--verm); }

.station__sum { margin: -3px 0 0; font-size: 12.5px; color: var(--mute); overflow-wrap: anywhere; }

.station--off .station__title,
.station--off .station__sum { color: var(--faint); }
.station__note { margin: 8px 0 0; font-size: 12px; color: var(--mute); }
.station__note--stale { color: var(--ochre); }
.station__note--error { color: var(--verm); background: var(--verm-bg); border-left: 3px solid var(--verm); padding: 8px; font-weight: 600; }
#save-unverified-note { display: none; }
#station-save[data-save-unverified="1"] .station__note:not(#save-unverified-note),
#station-save[data-save-unverified="1"] #save-report { display: none; }
#station-save[data-save-unverified="1"] #save-unverified-note { display: block; }
.station .save-report { margin-top: 12px; font-size: 11px; }
.station__action { margin-top: 10px; }

/* Interpret 事实表 (原生 <details>: 默认收起, 站体保持一行) */
.facts-box { margin-top: 8px; font-size: 12px; }
.facts-box summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 12px;
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 12px;
}

.facts dt { color: var(--mute); }

.facts dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Propose 修复卡 */
.fixes {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fix {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 12.5px;
}

.fix__name { font-weight: 600; min-width: 0; }
.fix__name small { display: block; font-size: 11.5px; font-weight: 400; color: var(--mute); }
.fix .btn { padding: 5px 10px; font-size: 11.5px; }
.fix--cur { border: 2px solid var(--ink); padding: 7px 9px; } /* 当前镜头/预览中的修复卡 (direction-2 .fix.cur) */

/* Diagnose 九项清单 (direction-2 .checks): 每项 summary 一行 label + 计数, 展开为中性说明 + 行号.
 * 有计数的项点一下 = 选中/取消该检查的镜头 (服务端渲染 open + check--sel). */
.checks {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

.check + .check { border-top: 1px solid var(--rule); }

.check__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  list-style: none;
  cursor: pointer;
}

.check__head::-webkit-details-marker { display: none; }
.check__head:hover { background: var(--surface-hover); }
.check__head:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.check__label { min-width: 0; line-height: 1.3; overflow-wrap: anywhere; } /* 296px 脊柱里长名换行, 不省略 */
.check__count { font-weight: 600; font-variant-numeric: tabular-nums; }
.check--zero .check__head { color: var(--faint); }
.check__ok { color: var(--green); }
.check--warn .check__count { color: var(--verm); }
.check--sel .check__head { background: var(--ink); color: #FFFFFF; }
.check--sel .check__count { color: #FFFFFF; }
.check__more { padding: 6px 10px 8px; background: var(--paper); font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.check__msg { margin: 0 0 4px; }
.check__rows { margin: 0; color: var(--mute); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.checks + .station__action { margin-top: 8px; }

/* 折叠 rail (76px): 只留编号 + 站名, 站体全部收起 */
.is-folded .spine__head { justify-content: center; padding: 0 0 10px; }
.is-folded .spine__title { display: none; }
.is-folded .spine__toggle { transform: rotate(180deg); }
.is-folded .station { height: 76px; padding: 0; }
.is-folded .station::before { left: 37px; top: 34px; }
.is-folded .station__num { left: 22px; top: 2px; }
.is-folded .station__main > :not(.station__title) { display: none; }

.is-folded .station__title {
  position: absolute;
  left: 0;
  top: 38px;
  width: var(--rail-width);
  padding: 2px 0;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 1px;
  background: var(--paper);
  text-align: center;
  font-size: 10.5px;
  line-height: 1.15;
  color: var(--mute);
}

/* rail 计数 (plan batch 2): 粗体一行在站名上方, 需留意/待保存沿用站色. */
.is-folded .station__count { font-size: 12px; font-weight: 700; color: var(--ink); }
.is-folded .station--att .station__count { color: var(--ochre); }
.is-folded .station--warn .station__count { color: var(--verm); }
