/* CastToolbox — 样式（浅色、响应式、工程风格） */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #1f2933;
  background: #f4f6f8;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* 顶部栏 */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: #1f3a5f; color: #fff;
  padding: 10px 18px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.topbar .tagline { font-size: 12px; opacity: .8; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar .btn {
  background: #2e5a8f; color: #fff; border: 1px solid #3f6ea3;
  padding: 7px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.topbar .btn:hover { background: #3f6ea3; }
.topbar select {
  background: #2e5a8f; color: #fff; border: 1px solid #3f6ea3;
  padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.topbar select option { color: #000; }

/* 布局 */
.layout { display: flex; align-items: flex-start; gap: 0; min-height: calc(100vh - 56px); }
.sidebar {
  width: 230px; flex: 0 0 230px;
  background: #fff; border-right: 1px solid #e2e8f0;
  padding: 14px 10px; min-height: 100%;
}
.sidebar h3 { font-size: 12px; text-transform: uppercase; color: #64748b; margin: 6px 8px 10px; letter-spacing: .5px; }
.nav-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: 6px; font-size: 14px; color: #334155;
}
.nav-item:hover { background: #eef2f7; }
.nav-item.active { background: #1f3a5f; color: #fff; font-weight: 600; }
.nav-item.sub { padding-left: 26px; font-size: 13px; color: #475569; }
.nav-item.sub.active { background: #2e5a8f; color: #fff; }

.main { flex: 1; padding: 22px 28px; max-width: 1100px; }
.card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card .sub { color: #64748b; font-size: 13px; margin-bottom: 16px; }

/* 表单 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 22px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: #475569; font-weight: 600; }
.field input, .field select {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; background: #fff;
}
.field .hint { font-size: 11px; color: #94a3b8; }
.row-actions { display: flex; gap: 12px; margin-top: 16px; }
.btn-primary {
  background: #1f3a5f; color: #fff; border: none; padding: 10px 20px;
  border-radius: 6px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn-primary:hover { background: #2e5a8f; }
.btn-ghost {
  background: #fff; color: #334155; border: 1px solid #cbd5e1; padding: 10px 18px;
  border-radius: 6px; font-size: 14px; cursor: pointer;
}

/* 结果 */
.result {
  margin-top: 18px; background: #f0f7f4; border: 1px solid #cfe8dd;
  border-radius: 8px; padding: 14px 16px;
}
.result h4 { margin: 0 0 10px; font-size: 14px; color: #0f5132; text-transform: uppercase; letter-spacing: .5px; }
.result table { width: 100%; border-collapse: collapse; }
.result td { padding: 6px 8px; border-top: 1px solid #dceee6; font-size: 14px; }
.result td:first-child { color: #475569; width: 55%; }
.result td:last-child { font-weight: 600; color: #0f2f1f; text-align: right; }
.ok-yes { color: #0f9d58; font-weight: 700; }
.ok-no { color: #d93025; font-weight: 700; }

.notes {
  margin-top: 14px; background: #fff8e6; border: 1px solid #f3e3b3;
  border-radius: 8px; padding: 12px 14px; font-size: 13px; color: #6b5a18;
}

/* 材料表 */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid #e2e8f0; text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { background: #f1f5f9; color: #334155; position: sticky; top: 0; }
table.data tr:hover { background: #f8fafc; }

.disclaimer { font-size: 12px; color: #94a3b8; margin-top: 8px; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar .tagline { display: none; }
}

/* 功能与能力对比矩阵（v6.12，可展开） */
.cm-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cm-btn {
  background: #fff; color: #334155; border: 1px solid #cbd5e1; padding: 5px 12px;
  border-radius: 6px; font-size: 12px; cursor: pointer;
}
.cm-btn:hover { background: #eef2f7; }
.cm-reset { border-color: #fca5a5; color: #b91c1c; }
.cm-reset:hover { background: #fef2f2; }

/* 重置视图二次确认弹窗（v6.17） */
.cm-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.cm-modal {
  background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  max-width: 420px; width: 100%; padding: 20px 22px; box-sizing: border-box;
}
.cm-modal-title { margin: 0 0 8px; font-size: 17px; color: #0f172a; }
.cm-modal-msg { margin: 0 0 14px; font-size: 13px; color: #475569; line-height: 1.5; }
.cm-modal-scope { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cm-modal-scope label {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #1e293b;
  cursor: pointer; line-height: 1.4;
}
.cm-modal-scope input { margin-top: 2px; }
.cm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.cm-modal-actions .cm-btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.cm-btn.cm-confirm { background: #dc2626; color: #fff; border: 1px solid #dc2626; }
.cm-btn.cm-confirm:hover { background: #b91c1c; }
.cm-btn.cm-cancel { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.cm-btn.cm-cancel:hover { background: #f1f5f9; }
.cm-check { font-size: 12px; color: #475569; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.cm-table { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; font-size: 12px; }
.cm-row { display: flex; align-items: center; border-bottom: 1px solid #eef2f7; }
.cm-row:last-child { border-bottom: none; }
.cm-head { background: #f1f5f9; color: #334155; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.cm-data { background: #fff; }
.cm-data:hover { background: #f8fafc; }
.cm-data[data-feasible="0"] { opacity: .5; }
.cm-table.cm-hide-infeasible .cm-data[data-feasible="0"] { display: none; }
.cm-summary { display: flex; align-items: center; width: 100%; cursor: pointer; padding: 7px 10px; }
.cm-c-name { flex: 0 0 150px; font-weight: 600; color: #1f2933; }
.cm-c-tol { flex: 0 0 96px; text-align: left; color: #475569; }
.cm-c-ra { flex: 0 0 96px; text-align: left; color: #475569; }
.cm-c-mass { flex: 0 0 130px; text-align: left; color: #475569; }
.cm-c-alloy { flex: 0 0 92px; text-align: left; color: #475569; }
.cm-c-tags { flex: 0 0 56px; text-align: center; color: #64748b; }
.cm-c-caret { flex: 0 0 24px; text-align: center; color: #94a3b8; transition: transform .15s; }
.cm-row.cm-expanded .cm-c-caret { transform: rotate(90deg); color: #1f3a5f; }
.cm-detail { display: none; padding: 0 10px 12px 160px; }
.cm-row.cm-expanded .cm-detail { display: block; }
.cm-desc { color: #475569; line-height: 1.55; margin-bottom: 6px; }
.cm-desc b, .cm-capsrow b { color: #1f3a5f; margin-right: 6px; }
.cm-capsrow { display: flex; align-items: baseline; flex-wrap: wrap; }
.cm-chip {
  display: inline-block; padding: 1px 8px; margin: 2px 5px 2px 0;
  border: 1px solid #cbd5e1; border-radius: 10px; font-size: 11px; color: #334155; background: #f8fafc;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.cm-chip:hover { background: #e2e8f0; border-color: #94a3b8; }
/* v6.13：排序 + 能力筛选 */
.cm-sep { width: 1px; height: 18px; background: #e2e8f0; margin: 0 2px; }
.cm-sortlabel { font-size: 12px; color: #475569; }
.cm-select {
  font-size: 12px; color: #334155; padding: 3px 6px; border: 1px solid #cbd5e1;
  border-radius: 6px; background: #fff; cursor: pointer;
}
.cm-filtbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.cm-filtlabel { font-size: 12px; color: #475569; margin-right: 2px; }
.cm-capfilter {
  display: inline-block; padding: 2px 9px; border: 1px solid #cbd5e1; border-radius: 12px;
  font-size: 11px; color: #475569; background: #f8fafc; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.cm-capfilter:hover { background: #eef2f7; border-color: #94a3b8; }
.cm-capfilter.cm-active { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }
.cm-clear { margin-left: 4px; padding: 2px 9px; font-size: 11px; }
.cm-data.cm-hidden { display: none; }
/* v6.14：表头点击排序 */
.cm-head [data-sortkey] { cursor: pointer; user-select: none; transition: background .12s; }
.cm-head [data-sortkey]:hover { background: #e2e8f0; }
.cm-head [data-sortkey].cm-sort-asc,
.cm-head [data-sortkey].cm-sort-desc { color: #1f3a5f; }
.cm-arrow { font-size: 10px; color: #1f3a5f; margin-left: 2px; }
@media (max-width: 760px) {
  .cm-c-tol, .cm-c-ra, .cm-c-mass, .cm-c-alloy { flex-basis: 64px; font-size: 11px; }
  .cm-c-name { flex-basis: 110px; }
  .cm-detail { padding-left: 10px; }
}
