﻿/* =====================================================================
   E-QS · DFMEA 演示页 — 交互演示 v2
   对齐真实编辑器：4 个工作区 + 子导航 + 结构/功能/失效三列
   + 结构框图 / ADV&P / 特殊特性清单 / 结果文件化
   ===================================================================== */

.ys-sim { height: 706px; }
.ys-sim-main { display: none; }

/* --- 工作区页签 --- */
.ys-wsbar {
  display: flex; align-items: flex-end; gap: 2px; padding: 0 14px;
  border-bottom: 1px solid var(--line); background: #fff; flex: 0 0 auto;
}
.ys-ws-tab {
  position: relative; border: 0; background: transparent;
  padding: 9px 14px 8px; border-radius: 9px 9px 0 0;
  font-size: 11.5px; font-weight: 700; color: var(--faint);
  transition: color .18s, background .18s; text-align: left;
}
.ys-ws-tab b {
  display: block; font-size: 9px; font-weight: 600; color: #b3c1d4;
  letter-spacing: .01em; margin-top: 1px;
}
.ys-ws-tab:hover { color: var(--ink2); background: #f7fafd; }
.ys-ws-tab.is-on { color: var(--brand); background: var(--brand-soft); }
.ys-ws-tab.is-on b { color: #7f9fc9; }
.ys-ws-tab.is-on::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; border-radius: 2px 2px 0 0; background: var(--brand);
}
.ys-stepdots { margin-left: auto; display: flex; align-items: center; gap: 3px; padding-bottom: 9px; }
.ys-stepdot {
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 8.5px; font-weight: 800;
  background: #eef2f8; color: #aab8cb;
  transition: background .3s, color .3s, box-shadow .3s;
}
.ys-stepdot.done { background: #d9f6ea; color: #047857; }
.ys-stepdot.on { background: var(--brand); color: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

/* --- 子导航 --- */
.ys-subbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 14px; border-bottom: 1px solid var(--line);
  background: #f8fbff; flex: 0 0 auto;
}
.ys-subbtn {
  border: 1px solid transparent; background: transparent;
  border-radius: 7px; padding: 4px 10px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  transition: all .16s;
}
.ys-subbtn:hover { background: #fff; color: var(--ink2); }
.ys-subbtn.is-on {
  background: #fff; border-color: #bfdbfe; color: var(--brand);
  box-shadow: 0 1px 2px rgba(37, 99, 235, .08);
}
.ys-subbtn i { font-size: 9px; margin-right: 4px; opacity: .8; }
.ys-subnote { margin-left: auto; font-size: 9.5px; color: var(--faint); }
.ys-subnote b { color: var(--brand); font-weight: 700; }

/* --- 视图容器 --- */
.ys-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.ys-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.ys-view.is-on { display: flex; }

/* ============ 三列工作区 ============ */
.ys-work { flex: 1; min-height: 0; display: grid; grid-template-columns: 212px 248px minmax(0, 1fr) 306px; }
.ys-col {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: #fff;
}
.ys-col:last-child { border-right: 0; }
.ys-col-hd {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--ink2); background: #fff;
}
.ys-col-hd .r { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ys-col-hd .switch {
  font-size: 8.5px; color: var(--faint); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.ys-col-hd .switch em {
  width: 20px; height: 11px; border-radius: 999px; background: #cfe0f5;
  position: relative; display: inline-block;
}
.ys-col-hd .switch em::after {
  content: ''; position: absolute; right: 1.5px; top: 1.5px;
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.ys-cbtn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--faint); font-size: 9.5px;
  display: grid; place-items: center; transition: all .16s;
}
.ys-cbtn:hover { color: var(--brand); border-color: #bfdbfe; background: var(--brand-soft); }
.ys-cbtn.is-ai {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 3px 8px -3px rgba(37, 99, 235, .6);
}
.ys-cbtn.is-ai.is-busy { animation: ysWand 1.1s ease-in-out infinite; }
@keyframes ysWand {
  0%, 100% { box-shadow: 0 3px 8px -3px rgba(37, 99, 235, .6); }
  50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .16); }
}
.ys-col-body { flex: 1; overflow: auto; min-height: 0; }

/* 树：层级缩进 + 导引线 + 展开箭头，体现 BOM 父子关系 */
.ys-tree2 { padding: 8px 6px 10px; display: flex; flex-direction: column; gap: 0; }
.ys-tree2 .ys-tnode {
  position: relative;
  padding: 4px 6px 4px calc(6px + var(--lv, 0) * 16px);
  border-radius: 6px; font-size: 11px;
}
/* 每一级在父级所在的列上画一条竖向导引线 */
.ys-tnode[data-lv="1"]::before,
.ys-tnode[data-lv="2"]::before,
.ys-tnode[data-lv="3"]::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 1px;
  left: calc(6px + (var(--lv, 1) - 1) * 16px + 6px);
  background: #dbe6f3;
}
/* 拐角短横线，接上图标 */
.ys-tnode[data-lv="1"]::after,
.ys-tnode[data-lv="2"]::after,
.ys-tnode[data-lv="3"]::after {
  content: ''; position: absolute; top: 50%; height: 1px; width: 7px;
  left: calc(6px + (var(--lv, 1) - 1) * 16px + 6px);
  background: #dbe6f3;
}
/* 同级最后一个孩子：竖线止于中心，形成 └ 拐角 */
.ys-tnode.is-last::before { bottom: 50%; }

.ys-tree2 .ys-tnode[data-lv="0"] {
  font-size: 11.5px; font-weight: 700; color: #1e2d42;
  background: #f4f9ff; border: 1px solid #e3eefa; margin-bottom: 3px;
}
.ys-tree2 .ys-tnode[data-lv="1"] {
  font-weight: 700; color: #2b3c52;
}
.ys-tree2 .ys-tnode[data-lv="2"] {
  font-weight: 500; color: #4a5c73;
}
.ys-tree2 .ys-tnode[data-lv="2"] .nm { color: #4a5c73; }
.ys-tree2 .ys-tnode .tw {
  width: 12px; height: 12px; flex: 0 0 12px; border-radius: 3px;
  display: grid; place-items: center; font-size: 8px; color: #9db0c6;
}
.ys-tree2 .ys-tnode .tw.has { color: #6b8db3; background: #eef4fb; }
.ys-tree2 .ys-tnode .tw.has:hover { background: #e0edfa; color: var(--brand); }
.ys-tree2 .ys-tnode .badge {
  height: 15px; min-width: 16px; padding: 0 4px; font-size: 9px;
}
.ys-tree2 .ys-tnode .badge.has { background: var(--brand); color: #fff; }
.ys-tree2 .ys-tnode[data-lv="1"] > i.fa-solid { color: #8fb4d6 !important; }
.ys-tree2 .ys-tnode.is-collapsed .tw i { transform: rotate(-90deg); }
.ys-tree2 .ys-tnode.is-hidden { display: none; }
.ys-empty-hint {
  padding: 22px 12px; text-align: center; color: #a9b8cc; font-size: 10.5px; line-height: 1.7;
}
.ys-empty-hint i { display: block; font-size: 17px; margin-bottom: 7px; color: #c8d6e8; }
.ys-empty-hint b { color: var(--brand); font-weight: 700; }

/* 功能卡 */
.ys-fn2 {
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  margin-bottom: 7px; overflow: hidden;
  opacity: 0; transform: translateY(7px); animation: ysRowIn .44s ease forwards;
}
.ys-fn2.lvl2 { margin-left: 11px; }
.ys-fn2.lvl3 { margin-left: 22px; }
.ys-fn2 .hd {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: #f8fbff; border-bottom: 1px solid var(--line2);
  font-size: 9px; font-weight: 700; color: #7f93ac;
}
.ys-fn2 .hd .kind {
  padding: 0 6px; border-radius: 999px; background: #e8f1fd; color: var(--brand);
  font-size: 8.5px; letter-spacing: .02em;
}
.ys-fn2 .bd { padding: 7px 9px; font-size: 10.5px; line-height: 1.55; color: #334155; }
.ys-fn2 .ft { display: flex; align-items: center; gap: 5px; padding: 0 9px 7px; flex-wrap: wrap; }
.ys-fn2 .reqchip {
  font-size: 8.5px; font-weight: 700; color: #6d28d9;
  background: #f5f3ff; border: 1px solid #e4dcff; border-radius: 4px; padding: 0 5px;
}
.ys-fn2 .ai-mark { font-size: 8.5px; color: #0ea5e9; font-weight: 700; margin-left: auto; }

/* 失效卡 */
.ys-fail {
  border: 1px solid var(--line); border-left: 3px solid #cbd5e1; border-radius: 9px;
  background: #fff; margin-bottom: 8px; overflow: hidden;
  opacity: 0; transform: translateY(7px); animation: ysRowIn .45s ease forwards;
}
.ys-fail.h { border-left-color: var(--danger); }
.ys-fail.m { border-left-color: var(--amber); }
.ys-fail .hd {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px;
  border-bottom: 1px solid var(--line2); background: #fcfdff;
}
.ys-fail .hd .fm { font-size: 10.5px; font-weight: 700; color: var(--ink2); flex: 1; line-height: 1.4; }
.ys-fail .row {
  display: grid; grid-template-columns: 30px 1fr; gap: 5px;
  padding: 4px 9px; font-size: 10px; line-height: 1.5; color: #475569;
}
.ys-fail .row dt { color: #a0b0c5; font-weight: 700; font-size: 9px; padding-top: 1px; }
.ys-fail .sod {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 6px 9px; border-top: 1px dashed var(--line); background: #fbfdff;
  font-size: 9px; color: var(--faint);
}
.ys-sod-box {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--mono); font-size: 9px; font-weight: 700; color: var(--ink2);
}
.ys-sod-box span {
  width: 15px; height: 15px; border-radius: 4px; background: #f1f5fb;
  display: grid; place-items: center;
}
.ys-sod-box span.s { background: #fff1f4; color: #be123c; }
.ys-sod-box span.o { background: #fffbeb; color: #b45309; }
.ys-sod-box span.d { background: #ecfdf5; color: #047857; }
.ys-fail .act {
  padding: 6px 9px; border-top: 1px solid var(--line2);
  font-size: 9.5px; color: #64748b; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ys-fail .act b { color: var(--ink2); font-weight: 600; }
.ys-fail .act .who {
  margin-left: auto; background: #f1f5fb; border-radius: 999px; padding: 1px 7px;
  font-size: 8.5px; color: #475569; font-weight: 600;
}

/* ============ 策划视图 ============ */
.ys-plan { flex: 1; overflow: auto; padding: 14px 18px; background: #fff; }
.ys-plan-head {
  display: flex; align-items: center; gap: 10px; padding-bottom: 11px;
  border-bottom: 1px solid var(--line2); margin-bottom: 13px;
}
.ys-plan-head .ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 13px;
}
.ys-plan-head h4 { font-size: 12.5px; font-weight: 700; }
.ys-plan-head p { font-size: 10px; color: var(--faint); margin-top: 2px; }
.ys-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.ys-fld { font-size: 9.5px; font-weight: 700; color: #7f93ac; }
.ys-fld span.label { display: block; margin-bottom: 3px; }
.ys-fld span.label i { margin-right: 3px; opacity: .7; }
.ys-fld input, .ys-fld textarea, .ys-fld .val {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 8px; font-size: 10.5px; color: var(--ink2); background: #fff;
  font-family: inherit; line-height: 1.45; resize: none;
}
.ys-fld .val { background: #fafcfe; }
.ys-fld .val.em { color: #b6c3d5; }
.ys-plan-grid .span2 { grid-column: span 2; }
.ys-plan-grid .span3 { grid-column: span 3; }
.ys-5t {
  font-size: 9px; font-weight: 700; color: #0f766e; background: #ecfdf8;
  border: 1px solid #b7ece2; border-radius: 5px; padding: 1px 6px;
}
.ys-5t.lead { color: #6d28d9; background: #f5f3ff; border-color: #e4dcff; }
.ys-team { display: flex; gap: 4px; flex-wrap: wrap; }
.ys-team span {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; color: #475569; background: #f4f8fd;
  border: 1px solid var(--line2); border-radius: 999px; padding: 2px 8px 2px 2px;
}
.ys-team span i {
  width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center;
  background: #dbeafe; color: #1d4ed8; font-size: 7.5px; font-weight: 800; font-style: normal;
}
.ys-langsel { display: flex; gap: 4px; }
.ys-langsel span {
  font-size: 9.5px; font-weight: 600; padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted); background: #fff;
}
.ys-langsel span.on { border-color: #bfdbfe; background: var(--brand-soft); color: var(--brand); }

/* ============ 框图画布 ============ */
.ys-canvas-wrap { flex: 1; min-height: 0; padding: 10px 12px; background: #fff; display: flex; }
.ys-canvas {
  position: relative; flex: 1; border-radius: 10px;
  border: 1px solid var(--line); background:
    radial-gradient(circle at 1px 1px, #e6edf7 1px, transparent 0) 0 0 / 18px 18px,
    #fcfdff;
  overflow: hidden;
}
.ys-boundary {
  position: absolute; left: 6%; top: 4%; right: 6%; bottom: 10%;
  border: 1.5px dashed #a8c8ea; border-radius: 14px;
  background: rgba(37, 99, 235, .022);
}
.ys-boundary::after {
  content: '系统边界';
  position: absolute; left: 12px; top: -8px; padding: 0 6px;
  background: #fcfdff; font-size: 8.5px; font-weight: 800; color: #7b9cc4;
  letter-spacing: .06em;
}
/* 边界端口：接口的对外出入口 */
.ys-port {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  font-size: 8.5px; font-weight: 700; color: #7c3aed;
  background: #faf8ff; border: 1px dashed #c4b5fd;
  box-shadow: 0 0 0 3px #fcfdff;
}
.ys-port i { font-size: 7.5px; opacity: .8; }
.ys-port.left { left: 0; top: 49%; }
.ys-port.right { left: 100%; top: 49%; }
.ys-cnode {
  position: absolute; transform: translate(-50%, -50%);
  padding: 5px 9px; border-radius: 7px; background: #fff;
  border: 1px solid #d7e3f1; box-shadow: 0 3px 8px -5px rgba(15, 23, 42, .3);
  font-size: 9px; font-weight: 700; color: #24354b; text-align: center;
  white-space: nowrap; line-height: 1.3; letter-spacing: -.01em;
}
.ys-cnode small { display: block; font-size: 7px; font-weight: 600; color: #9aabc0; letter-spacing: 0; }
.ys-cnode.root {
  padding: 7px 13px; font-size: 10px; border-radius: 8px;
  background: linear-gradient(135deg, #0f2a4a, #0e7490); color: #fff; border-color: transparent;
  box-shadow: 0 8px 18px -10px rgba(15, 42, 74, .8);
}
.ys-cnode.root small { color: rgba(255, 255, 255, .72); }
.ys-cnode.parent {
  background: #f5faff; border-color: #b9d5f0; color: #1e3a5f;
  border-bottom: 2px solid #8fbde6;
}
.ys-cnode.leaf { background: #fff; }
.ys-cnode.is-hit { box-shadow: 0 0 0 3px rgba(37, 99, 235, .16), 0 6px 14px -6px rgba(15, 23, 42, .3); }
.ys-canvas svg.links { position: absolute; inset: 0; width: 100%; height: 100%; }
/* 接口标签：贴在虚线中段 */
.ys-iface-lbl {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  font-size: 7px; font-weight: 700; color: #7c3aed; background: #faf8ff;
  border: 1px solid #e4dcff; border-radius: 4px; padding: 0 3px; white-space: nowrap;
}
.ys-canvas .legend {
  position: absolute; left: 10px; bottom: 8px; display: flex; gap: 10px;
  font-size: 8px; color: #8fa1b8; background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
}
.ys-canvas .legend i {
  display: inline-block; width: 14px; height: 0; border-top: 2px solid #9fb6d1;
  vertical-align: middle; margin-right: 3px;
}
.ys-canvas .legend i.dash { border-top-style: dashed; border-color: #a78bfa; }
.ys-canvas-tools {
  position: absolute; right: 8px; top: 8px; display: flex; gap: 3px;
  background: rgba(255, 255, 255, .94); border: 1px solid var(--line);
  border-radius: 7px; padding: 3px; box-shadow: var(--shadow-sm);
}
.ys-canvas-tools span {
  width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center;
  font-size: 8px; color: #94a3b8;
}
.ys-canvas-tools span.on { background: var(--brand-soft); color: var(--brand); }

/* ============ 宽表格视图（ADV&P / 特殊特性） ============ */
.ys-wide { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.ys-wide-hd {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.ys-wide-hd h4 { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ys-wide-hd h4 i { color: var(--brand); font-size: 11px; }
.ys-wide-hd .tools { margin-left: auto; display: flex; gap: 5px; }
.ys-toolbtn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 600; color: #475569;
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px;
}
.ys-toolbtn i { font-size: 8.5px; color: #94a3b8; }
.ys-toolbtn.is-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ys-toolbtn.is-primary i { color: rgba(255, 255, 255, .8); }
.ys-toolbtn.is-sync { background: var(--teal-soft); border-color: #b7ece2; color: #0f766e; }
.ys-toolbtn.is-sync i { color: #0f766e; }
.ys-scroll { flex: 1; overflow: auto; min-height: 0; }
.ys-tbl { width: 100%; border-collapse: collapse; font-size: 10px; }
.ys-tbl th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 700; color: #6b7d94; font-size: 9px;
  background: #f6f9fd; padding: 6px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ys-tbl th small { display: block; font-size: 8px; font-weight: 500; color: #a3b2c6; }
.ys-tbl td {
  padding: 6px 8px; border-bottom: 1px solid var(--line2);
  color: #3b4a60; vertical-align: top; line-height: 1.5;
}
.ys-tbl tbody tr { opacity: 0; animation: ysRowIn .38s ease forwards; }
.ys-tbl tbody tr:hover td { background: #fbfdff; }
.ys-tbl .cat { display: inline-block; font-size: 8.5px; font-weight: 700; border-radius: 4px; padding: 0 5px; }
.ys-tbl .cat.detect { color: #0369a1; background: #e0f2fe; }
.ys-tbl .cat.optimize { color: #b45309; background: #fffbeb; }
.ys-tbl .st { font-size: 8.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.ys-tbl .st.open { color: #b91c1c; background: #fff1f4; }
.ys-tbl .st.doing { color: #b45309; background: #fffbeb; }
.ys-tbl .st.done { color: #047857; background: #ecfdf5; }
.ys-tbl .sc-tag {
  display: inline-block; font-size: 8.5px; font-weight: 800; letter-spacing: .04em;
  border-radius: 4px; padding: 0 5px; color: #fff;
}
.ys-tbl .sc-tag.sc { background: linear-gradient(135deg, #f59e0b, #f97316); }
.ys-tbl .sc-tag.cc { background: linear-gradient(135deg, #e11d48, #be123c); }
.ys-wide-foot {
  padding: 6px 14px; border-top: 1px solid var(--line); background: #fafcfe;
  font-size: 9px; color: #9aabc0; flex: 0 0 auto;
}

/* ============ 文件化视图 ============ */
.ys-doc { flex: 1; overflow: auto; padding: 14px 16px; background: #fff; }
.ys-doc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.ys-doc-stat { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #fcfdff; }
.ys-doc-stat b {
  display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--brand);
}
.ys-doc-stat b.h { color: var(--danger); }
.ys-doc-stat b.m { color: var(--amber); }
.ys-doc-stat b.n { color: #64748b; }
.ys-doc-stat span { display: block; font-size: 9px; color: #8fa1b8; font-weight: 600; margin-top: 1px; }
.ys-doc-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ys-doc-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff;
  display: flex; flex-direction: column; gap: 6px;
}
.ys-doc-card .ic {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; background: #ecfdf5; color: #059669;
}
.ys-doc-card .ic.json { background: #eef2ff; color: #4f46e5; }
.ys-doc-card h5 { font-size: 11.5px; font-weight: 700; }
.ys-doc-card p { font-size: 10px; color: #7c8ca3; line-height: 1.55; }
.ys-doc-card .btn-mock {
  margin-top: 2px; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; border-radius: 7px; padding: 5px 11px;
  background: var(--brand); color: #fff;
}
.ys-doc-card .btn-mock.sec { background: #fff; color: var(--ink2); border: 1px solid var(--line); }
.ys-excel-strip { margin-top: 11px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.ys-excel-hd {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  background: #f6f9fd; border-bottom: 1px solid var(--line);
  font-size: 9px; font-weight: 700; color: #6b7d94;
}
.ys-excel-hd .ok { margin-left: auto; color: #047857; font-weight: 700; }
.ys-excel-hd .ok i { font-size: 8px; }
.ys-excel-grid {
  display: grid; grid-template-columns: 60px 1.02fr .9fr .96fr 36px 36px 36px 34px;
  font-size: 8px; color: #475569;
}
.ys-excel-grid div {
  padding: 3px 5px; border-bottom: 1px solid #eef3fa; border-right: 1px solid #eef3fa;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ys-excel-grid .h {
  background: #eff6ff; color: #1e40af; font-weight: 800; font-size: 7.5px;
  text-align: center; letter-spacing: .02em;
}
.ys-excel-grid .grp {
  background: #dbeafe; color: #1e3a8a; font-weight: 800; text-align: center;
  font-size: 7.5px; letter-spacing: .03em; border-bottom-color: #c7ddf7;
}
.ys-excel-grid .apcell { font-weight: 800; text-align: center; }
.ys-excel-grid .apcell.h { color: #e11d48; }
.ys-excel-grid .apcell.m { color: #b45309; }

/* --- 响应式 --- */
@media (max-width: 1200px) {
  .ys-work { grid-template-columns: 200px 236px minmax(0, 1fr) 296px; }
}
@media (max-width: 1120px) {
  .ys-work { grid-template-columns: 186px 214px minmax(0, 1fr) 268px; }
}
@media (max-width: 980px) {
  .ys-work { grid-template-columns: 176px 200px minmax(0, 1fr) 250px; }
  .ys-req-foot .ys-review-btns { gap: 4px; }
}
@media (max-width: 900px) {
  .ys-sim { height: 660px; }
  .ys-body { overflow-x: auto; }
  .ys-work { min-width: 830px; grid-template-columns: 186px 210px minmax(300px, 1fr) 262px; }
  .ys-wsbar { overflow-x: auto; }
  .ys-ws-tab { flex: 0 0 auto; }
  .ys-stepdots { display: none; }
  .ys-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ys-doc-stats { grid-template-columns: repeat(2, 1fr); }
  .ys-canvas { min-width: 780px; }
  .ys-canvas-wrap { overflow-x: auto; }
}
@media (max-width: 640px) {
  .ys-sim { height: 620px; }
  .ys-plan-grid { grid-template-columns: 1fr; }
  .ys-plan-grid .span2, .ys-plan-grid .span3 { grid-column: span 1; }
  .ys-doc-cards { grid-template-columns: 1fr; }
  .ys-subbar { overflow-x: auto; flex-wrap: nowrap; }
  .ys-subbtn { flex: 0 0 auto; }
}

/* 顶部工具栏右侧按钮组 */
.ys-sim-top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* 需求列底部与整体贴合 */
.ys-col .ys-req-foot { border-top: 1px solid var(--line); }

/* 树节点被选中 */
.ys-tnode.is-sel { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px #cfe3fb; }

/* 抽屉关闭时不占横向滚动空间（否则 transform 会把 scrollWidth 撑宽） */
.ys-drawer { display: none; }
.ys-drawer.is-open { display: flex; transform: none; animation: ysDrawerIn .36s cubic-bezier(.3, .9, .3, 1); }
@keyframes ysDrawerIn { from { transform: translateX(100%); } to { transform: none; } }

/* 移动端抽屉占满 */
@media (max-width: 640px) {
  .ys-drawer { width: 100%; }
}

/* 桌面端：body 内不产生横向滚动（抽屉滑入不再撑宽） */
.ys-body { overflow: hidden; }
@media (max-width: 900px) { .ys-body { overflow-x: auto; overflow-y: hidden; } }

.ys-toolbtn { cursor: pointer; }
.ys-toolbtn:hover { background: var(--brand-soft); border-color: #bfdbfe; color: var(--brand); }
.ys-toolbtn.is-primary:hover { background: #1d4ed8; color: #fff; }
.ys-toolbtn.is-sync:hover { background: #d9f7f1; color: #0f766e; }
.ys-req-drop { cursor: pointer; }

/* 树顶层级图例 */
.ys-tree-legend {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  padding: 5px 8px 6px; margin: -8px -6px 4px;
  border-bottom: 1px dashed #e6eefa; background: #fafcff;
  font-size: 8.5px; font-weight: 700; color: #9db0c6; letter-spacing: .01em;
}
.ys-tree-legend span { white-space: nowrap; }
.ys-tree-legend i { font-style: normal; color: #cbd8e7; font-size: 8px; }

/* 展开箭头过渡 */
.ys-tree2 .ys-tnode .tw i { transition: transform .18s ease; }

/* 层级视觉：L1 有底色，L2 缩进带导引线 */
.ys-tree2 .ys-tnode[data-lv="1"] { border-radius: 6px; }
.ys-tree2 .ys-tnode[data-lv="1"]:hover,
.ys-tree2 .ys-tnode[data-lv="2"]:hover { background: #f2f8ff; }

/* 子系统之间留一点组间距，层级更清晰 */
.ys-tree2 .ys-tnode[data-lv="1"]:not(:first-of-type) { margin-top: 3px; }
.ys-tree2 .ys-tnode[data-lv="2"]:last-of-type { margin-bottom: 2px; }
