/* ============================================================
   [打样订单管理系统] 失效模式管理（FMEA）专用样式
   2026-09-28 代码整理：从 assets/app.css 抽出（配合 js/17-fmea.js）。
   后续 FMEA 相关样式只需改本文件。顶栏 mode 规则（body.mode-fmea）
   与侧栏通用树样式仍在 app.css，不在本文件范围。
   ============================================================ */

/* ---- 分区容器：默认隐藏，加 .active 显示（new / module / product 三分区） ---- */
.fmea-pane { display: none; }
.fmea-pane.active { display: block; }

/* ---- 分区占位卡片（new / product 分区用） ---- */
.fmea-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 16px; min-height: 320px; text-align: center;
    border: 1px dashed #dbe3f0; border-radius: 8px;
    background: linear-gradient(180deg, #fafcff 0%, #f3f7fd 100%);
}
.fmea-placeholder > i {
    font-size: 2.6rem; color: var(--primary); margin-bottom: 12px; opacity: .82;
}

/* ---- 模块管理主区树形结构：DFMEA / PFMEA 两个主节点，点节点头展开 / 收起内容区 ---- */
.fmea-mod-tree { display: flex; flex-direction: column; gap: 10px; }
.fmea-tree-node {
    border: 1px solid #e6ecf5; border-radius: 10px; background: #fff;
    overflow: hidden;
}
.fmea-tree-node-head {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 14px; border: none; background: #f7f9fd;
    cursor: pointer; text-align: left; font-family: inherit;
    transition: background 0.18s ease;
}
.fmea-tree-node-head:hover { background: #eef3fc; }
.fmea-tree-arrow {
    font-size: 0.8rem; color: #6b7da3; width: 14px; text-align: center;
    transition: transform 0.18s ease;
}
.fmea-tree-node-head[aria-expanded="true"] .fmea-tree-arrow { transform: rotate(90deg); }
.fmea-tree-node-head > .bi:not(.fmea-tree-arrow) { font-size: 1.05rem; color: var(--primary); }
.fmea-tree-node-title { font-size: 0.92rem; font-weight: 600; color: #2c3e66; }
.fmea-tree-node-sub { font-size: 0.72rem; font-weight: 400; color: #8a97b5; margin-left: 8px; }
.fmea-tree-node-body { padding: 12px 14px 14px; border-top: 1px solid #eef2fa; }

/* ---- DFMEA / PFMEA 节点内容表格：小字号 + 粘性表头 ---- */
.fmea-table-wrap { overflow-x: auto; max-height: 420px; }
.fmea-table { margin-bottom: 0; font-size: 0.78rem; }
.fmea-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: #f0f4fb; color: #2c3e66; font-size: 0.74rem;
    white-space: nowrap; vertical-align: middle;
}
.fmea-table td { vertical-align: middle; }

/* ---- 表格上方工具栏：新增条目 / 导出 / 导入 + 条数 ---- */
.fmea-table-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fmea-table-count { font-size: 0.72rem; color: #8a97b5; }

/* ---- 编号列：等宽字体 + 浅底 ---- */
.fmea-th-id, .fmea-td-id { width: 92px; text-align: center; }
.fmea-td-id { font-family: Consolas, monospace; font-size: 0.72rem; font-weight: 600; color: #2c3e66; background: #f7f9fd; white-space: nowrap; }
/* RPN 列（DFMEA 自动计算，只读）：居中加粗 */
.fmea-td-rpn { text-align: center; font-weight: 700; font-size: 0.82rem; color: #2c3e66; background: #f7f9fd; }
/* 操作列：删除按钮居中窄列 */
.fmea-th-op, .fmea-td-op { width: 52px; text-align: center; }
.fmea-row-del { padding: 2px 7px; font-size: 0.78rem; }

/* ---- 行内编辑输入框：紧凑小号 ---- */
.fmea-table .form-control-sm { font-size: 0.76rem; border-radius: 6px; padding: 4px 8px; }
.fmea-table td .form-control { min-width: 120px; }
.fmea-table .fmea-cell-score { min-width: 58px; text-align: center; }

/* ---- 空数据提示行 ---- */
.fmea-table-empty td {
    text-align: center; color: #9aa7c0; font-size: 0.78rem; padding: 26px 8px !important;
    background: #fafbfe;
}

/* ---- 模块管理页签：失效模块 / 盒型配置 ---- */
.fmea-mod-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e6ecf5; margin-bottom: 12px; }
.fmea-mod-tab {
    border: none; background: transparent; padding: 8px 14px;
    font-size: 0.84rem; font-weight: 600; color: #6b7da3;
    cursor: pointer; border-bottom: 2px solid transparent;
    font-family: inherit;
}
.fmea-mod-tab:hover { color: var(--primary); }
.fmea-mod-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- 盒型配置页签：工具栏 + 关联条目勾选区 ---- */
.fmea-box-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.fmea-box-bar .form-select-sm { width: auto; min-width: 170px; font-size: 0.8rem; }
.fmea-box-detail { display: flex; flex-direction: column; gap: 10px; }
.fmea-box-sec { border: 1px solid #e6ecf5; border-radius: 10px; background: #fff; padding: 10px 12px; }
.fmea-box-sec-title {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; font-weight: 600; color: #2c3e66; margin-bottom: 8px;
}
.fmea-box-sec-count { font-size: 0.72rem; font-weight: 400; color: #8a97b5; }
.fmea-box-pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.fmea-box-pick {
    display: flex; align-items: center; gap: 8px; padding: 4px 8px;
    border-radius: 6px; cursor: pointer; font-size: 0.78rem;
}
.fmea-box-pick:hover { background: #f0f4fb; }
.fmea-box-pick input { flex: 0 0 auto; }
.fmea-box-pick-id { font-family: Consolas, monospace; font-weight: 600; color: #2c3e66; white-space: nowrap; }
.fmea-box-pick-txt { color: #6b7da3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmea-box-empty {
    padding: 36px 14px; text-align: center; color: #9aa7c0; font-size: 0.8rem;
    border: 1px dashed #dbe3f0; border-radius: 8px;
    background: linear-gradient(180deg, #fafcff 0%, #f3f7fd 100%);
}
.fmea-box-tip { font-size: 0.72rem; color: #8a97b5; margin: 2px 0 0; }

/* ---- 新建 FMEA 工作台：抬头字段栅格 ---- */
.fmea-doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; margin-bottom: 10px; }
.fmea-doc-grid label { font-size: 0.72rem; font-weight: 600; color: #6b7da3; margin: 0; }
.fmea-doc-grid input { margin-top: 3px; }
.fmea-doc-grid input[readonly] { background: #f3f6fb; color: #2c3e66; font-weight: 600; }
/* 工具栏：新建 / 存储 / 修改 + 历史搜索 */
.fmea-doc-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.fmea-doc-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.fmea-doc-hist {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    background: #fff; border: 1px solid #dbe3f0; border-radius: 8px;
    box-shadow: 0 8px 20px rgba(28, 50, 100, .12);
    max-height: 260px; overflow-y: auto;
}
.fmea-doc-hist-item {
    display: block; width: 100%; text-align: left; border: none; background: transparent;
    padding: 7px 10px; font-size: 0.76rem; color: #2c3e66; cursor: pointer;
    font-family: inherit; border-bottom: 1px solid #f0f4fb;
}
.fmea-doc-hist-item:last-child { border-bottom: none; }
.fmea-doc-hist-item:hover { background: #f0f4fb; }
.fmea-doc-hist-empty { padding: 12px; font-size: 0.74rem; color: #9aa7c0; text-align: center; }
/* 提示行（只读态说明 / 盒型带入） */
.fmea-doc-tip { font-size: 0.72rem; color: #8a97b5; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fmea-doc-tip .form-select-sm { width: auto; min-width: 150px; }
/* 文档内 DFMEA / PFMEA 表格分区 */
.fmea-doc-sec { border: 1px solid #e6ecf5; border-radius: 10px; background: #fff; padding: 10px 12px; margin-bottom: 10px; }
.fmea-doc-sec-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.84rem; font-weight: 600; color: #2c3e66; margin-bottom: 8px;
}
.fmea-doc-sec-title .fmea-doc-add { margin-left: auto; }
/* 产品目录下载列 */
.fmea-td-dl { text-align: center; white-space: nowrap; }
.fmea-td-dl .btn { padding: 2px 8px; font-size: 0.72rem; }

/* ---- 手机端（≤768px）：失效模式管理整个侧栏树隐藏 ----
   FMEA 表格列多、小屏体验差，入口仅保留给平板（769-991.98px 顶部横条单按钮）与桌面 */
@media (max-width: 768px) {
    #fmeaTree { display: none !important; }
    .fmea-doc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .fmea-doc-grid { grid-template-columns: 1fr; }
}
