/**
 * 佳誉 ERP 2.0 — 产品开发 / 版单录入（version_form、BOM 矩阵、Sheet 补丁）
 * 仅含 `.version-form-page` 等版单域选择器；通用表格见 ui_tables.css。
 */
/* BOM 分色矩阵：滚动区与顶栏 sticky，避免遮挡与点击穿透 */
.bom-matrix-wrapper {
    position: relative !important;
    z-index: 100 !important;
    margin-bottom: 100px !important;
}
.bom-matrix-scroll {
    overflow: auto !important;
    max-height: 70vh !important;
}
.bom-toolbar-top {
    position: sticky !important;
    top: 0 !important;
    z-index: 101 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 15px !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
    background: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}
.bom-toolbar-top .btn-success {
    margin-left: auto !important;
}
.bom-toolbar-top button {
    position: relative !important;
    z-index: 10000 !important;
    pointer-events: auto !important;
}
.bom-toolbar-top button.btn-outline-primary {
    background-color: #007bff !important;
    color: #fff !important;
    font-weight: bold !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* ==================== 版单录入（dev/version_form）最终物理标准（单源、禁止与模板重复打架） ==================== */
.tab-inner-content > .container-fluid.version-form-page {
    margin-top: 0;
}

/* 工具栏（版单录入标题行）：强制普通文档流，禁止 fixed/sticky 盖住下方字段（叠罗汉） */
.version-form-page .version-header-bar {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    transform: none !important;
}
/* 基础信息区：与标题行物理隔离；版单头为纵向 flex + 每排横向 flex（见 .vf-base-info-grid） */
.version-form-page .info-header-card {
    overflow-x: auto !important;
    overflow-y: visible !important;
    margin-top: 20px !important;
    -webkit-overflow-scrolling: touch;
}
/* 版单头：4 列 × 3 行 Grid（与 version_form 内联样式一致）；前两行各 4 字段，第三行款式图占第 4 列 */
.version-form-page .info-header-card .vf-base-info-grid--4col {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    align-items: center;
    justify-items: stretch;
    justify-content: start;
}
.version-form-page .info-header-card .vf-base-info-grid--4col > .vf-pair {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px;
    min-height: 30px;
    min-width: 0 !important;
    width: 100%;
    box-sizing: border-box;
}
.version-form-page .info-header-card .vf-base-info-grid--4col > .vf-pair--cover-anchor {
    grid-column: 4;
}
.version-form-page .info-header-card .vf-base-info-grid--4col > .vf-pair > .vf-label {
    display: block !important;
    box-sizing: border-box !important;
    flex: 0 0 6em !important;
    width: 6em !important;
    min-width: 6em !important;
    max-width: 6em !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
    text-align: right !important;
    align-self: center !important;
}
.version-form-page .info-header-card .vf-base-info-grid--4col > .vf-pair > .vf-slot {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 30px;
}
.version-form-page .info-header-card .vf-base-info-grid--4col .vf-control:not(#sheet_code_display):not(#style_name),
.version-form-page .info-header-card .vf-base-info-grid--4col .vf-version-readonly {
    width: 90px !important;
    min-width: 72px !important;
    max-width: 100%;
    flex: 0 0 auto;
}
.version-form-page .info-header-card .vf-base-info-grid--4col #sheet_code_display.vf-control,
.version-form-page .info-header-card .vf-base-info-grid--4col #style_name.vf-control {
    width: 180px !important;
    min-width: 160px !important;
}
.version-form-page .info-header-card .vf-base-info-grid--4col .vf-cover-row {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
}
.version-form-page .info-header-card .vf-base-info-grid--4col .vf-cover-path {
    width: 90px !important;
    flex: 0 0 90px;
    min-width: 72px !important;
}
.version-form-page .info-header-card .vf-base-info-grid--4col .vf-cover-browse {
    flex: 0 0 30px;
    width: 30px !important;
    min-width: 28px !important;
}

/* Sheet8 工艺说明 / Sheet9 二次工艺：多条文本记录展示区 + 标题栏右侧「新增」 */
.version-form-page .sheet-section-header--split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-form-page .sheet-section-header--split .btn {
    min-width: 80px;
    height: 30px;
    padding: 2px 10px;
    font-size: 14px;
    box-sizing: border-box;
}
/* Sheet1 颜色维护：新增行按钮统一右置 */
.version-form-page #pane-s1 .sheet-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-form-page #pane-s1 #btn-add-color {
    margin-left: auto;
}
/* 兼容历史 id */
.version-form-page #pane-s1 #btn-add-color-row {
    margin-left: auto;
}
/* Sheet4 单耗核算：新增行按钮统一右置（完整版单/轻量模块共用） */
.version-form-page #pane-s4 .consumption-sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-form-page #pane-s4 #btn-add-consumption {
    margin-left: auto;
}
/* Sheet2 尺码表：工具条在左，新增部位行在同一行最右 */
.version-form-page #pane-s2 .sheet-section-header-s2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-form-page #pane-s2 .sheet-section-header-s2 #size-action-bar,
.version-form-page #pane-s2 .sheet-section-header-s2 #size-list-toolbar,
.version-form-page #pane-s2 .sheet-section-header-s2 #size-detail-toolbar {
    flex: 1 1 auto;
    min-width: 0;
}
.version-form-page #pane-s2 #btn-add-size-row {
    margin-left: auto;
    flex: 0 0 auto;
}
/* Sheet6 工价表：新增工序按钮统一右置 */
.version-form-page #pane-s6 .sheet-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-form-page #pane-s6 #btn-add-process {
    margin-left: auto;
}
/* Sheet5 BOM：增加物料按钮右置（保留中间视图切换控件） */
.version-form-page #pane-s5 .bom-sheet-toolbar {
    display: flex;
    align-items: center;
    gap: 10px 12px;
}
.version-form-page #pane-s5 #btn-add-bom {
    margin-left: auto;
}
.version-form-page .text-entries-display {
    margin-top: 8px;
    min-height: 24px;
}
.version-form-page .text-entry-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fafafa;
    box-sizing: border-box;
}
.version-form-page .text-entry-card-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}
.version-form-page .text-entry-card-body {
    font-size: 14px;
    color: #111827;
    white-space: pre-wrap;
    word-break: break-word;
}
.version-form-page .text-entry-empty {
    font-size: 14px;
    color: #9ca3af;
    padding: 8px 0;
}
.version-form-page .s8-composer,
.version-form-page .s11-composer {
    margin-top: 10px;
}

/* Sheet11 版单排期：4 列表格线；第一行 4 格、第二行 3 格内容 + 1 空格左对齐 */
.version-form-page #pane-s11 .schedule-table-wrap {
    margin-top: 8px;
    width: 100%;
    overflow-x: auto;
}
.version-form-page #pane-s11 .schedule-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-bottom: 0;
}
.version-form-page #pane-s11 .schedule-table th,
.version-form-page #pane-s11 .schedule-table td {
    text-align: left;
    vertical-align: top;
}
.version-form-page #pane-s11 .schedule-cell {
    padding: 10px 12px;
    min-width: 0;
}
.version-form-page #pane-s11 .schedule-cell--empty {
    background: #fafafa;
}
.version-form-page #pane-s11 .schedule-field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 6px 0;
}
.version-form-page #pane-s11 .schedule-readonly-box {
    height: 30px;
    line-height: 30px;
    padding: 0 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #f3f4f6;
    border: 1px solid #ced4da;
    border-radius: 4px;
    color: #111827;
    max-width: 180px;
}
.version-form-page #pane-s11 .schedule-date-input {
    width: 180px !important;
    max-width: 100%;
}
.version-form-page #pane-s11 .schedule-countdown-row {
    margin-top: 10px;
}
.version-form-page #pane-s11 .schedule-countdown-text {
    font-size: 14px;
    color: #2563eb;
}

/* Sheet10 附件管理：先命名再上传；表格列 名称 / 文件 / 操作 */
.version-form-page #pane-s10 .attachment-toolbar {
    margin-bottom: 10px;
}
.version-form-page #pane-s10 .attachment-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    row-gap: 8px;
}
.version-form-page #pane-s10 .attachment-toolbar-inner .attachment-label {
    flex: 0 0 auto;
    margin: 0;
}
.version-form-page #pane-s10 .attachment-name-input {
    width: 220px;
    max-width: 100%;
    min-width: 0;
}
.version-form-page #pane-s10 .attachment-filename-hint {
    font-size: 13px;
    color: #6b7280;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.version-form-page #pane-s10 .attachment-toolbar-hint {
    margin-top: 6px;
    margin-bottom: 0;
}
.version-form-page #pane-s10 .attachment-table {
    width: 100%;
    margin-top: 4px;
}
.version-form-page #pane-s10 .attachment-col-actions {
    width: 200px;
    white-space: nowrap;
}
.version-form-page #pane-s10 .attachment-actions-cell .btn {
    width: 80px;
    height: 30px;
    padding: 2px 6px;
    font-size: 12px;
    box-sizing: border-box;
}
.version-form-page #pane-s10 .attachment-pick-btn,
.version-form-page #pane-s10 .attachment-upload-btn {
    height: 30px;
    padding: 2px 10px;
    font-size: 14px;
    box-sizing: border-box;
}

/* Sheet9 二次工艺：标题用 .sheet-section-header 与其它 Sheet 一致；文本域固定尺寸且禁止拖拽改大小；右侧提交（iframe 内不依赖 Bootstrap 工具类） */
.version-form-page #pane-s9 .secondary-process-editor {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 12px;
    margin-top: 8px;
}
.version-form-page #pane-s9 .secondary-process-textarea {
    width: 560px;
    max-width: 100%;
    min-width: 0;
    height: 120px;
    min-height: 120px;
    resize: none !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    line-height: 1.4;
    margin: 0 !important;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 8px;
}
.version-form-page #pane-s9 .secondary-process-submit-btn {
    flex-shrink: 0;
    width: 80px;
    height: 30px;
    padding: 0 !important;
    line-height: 28px !important;
    font-size: 14px !important;
    box-sizing: border-box;
}

/* Sheet8 工艺说明：与 Sheet9 二次工艺同一套（标题区 + 固定文本域 + 右侧提交） */
.version-form-page #pane-s8 .process-desc-editor {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 12px;
    margin-top: 8px;
}
.version-form-page #pane-s8 .process-desc-textarea {
    width: 560px;
    max-width: 100%;
    min-width: 0;
    height: 120px;
    min-height: 120px;
    resize: none !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    line-height: 1.4;
    margin: 0 !important;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 8px;
}
.version-form-page #pane-s8 .process-desc-submit-btn {
    flex-shrink: 0;
    width: 80px;
    height: 30px;
    padding: 0 !important;
    line-height: 28px !important;
    font-size: 14px !important;
    box-sizing: border-box;
}

/* Sheet13 SKU预览：颜色/尺码列内容居中；表宽随列定宽不拉满屏；内部 SKU 列有上限，右侧留白 */
.version-form-page #pane-s13 .sku-preview-table {
    width: auto !important;
    max-width: 100%;
    table-layout: fixed;
}
.version-form-page #pane-s13 .sku-preview-table th:nth-child(1),
.version-form-page #pane-s13 .sku-preview-table td:nth-child(1),
.version-form-page #pane-s13 .sku-preview-table th:nth-child(2),
.version-form-page #pane-s13 .sku-preview-table td:nth-child(2) {
    text-align: center !important;
    vertical-align: middle !important;
    width: 10em;
}
.version-form-page #pane-s13 .sku-preview-table th:nth-child(3),
.version-form-page #pane-s13 .sku-preview-table td:nth-child(3) {
    width: 14em;
    max-width: 240px;
    text-align: center;
    vertical-align: middle;
    word-break: break-all;
}
/* 不在 .version-form-page 上强制 overflow-*：由 .tab-panel 负责滚动，避免与内部表格/下拉叠层冲突 */

/* 1) 顶区：与全局顶栏对齐；不缩小系统标签栏高度（恢复默认 40px，避免「修了版单、别的标签难点的」） */
.main-content:has(.version-form-page) {
    padding-top: 64px;
}
.main-content:has(.version-form-page) .tabs-bar {
    margin: 0;
    padding: 0 5px;
}
.main-content:has(.version-form-page) .tab-inner-content {
    margin: 0;
    padding: 0 5px 8px;
}
.main-content:has(.version-form-page) .content-header,
.main-content:has(.version-form-page) .breadcrumb {
    margin: 0 !important;
    padding: 0 5px !important;
}

.version-form-page,
.version-form-page label,
.version-form-page th,
.version-form-page td {
    font-size: 14px !important;
}
.version-form-page .sheet-tabs-bar .tab {
    font-size: 14px !important;
}

/* Sheet1 颜色表：table-layout auto + 列最小宽度；窄屏在 .sheet-color-sheet-scroll-wrap 内横向滚动 */
.version-form-page .sheet-color-sheet-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.version-form-page .table-color-sheet {
    table-layout: auto;
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}
.version-form-page .table-color-sheet th,
.version-form-page .table-color-sheet td {
    text-align: center !important;
    vertical-align: middle !important;
}
.version-form-page .table-color-sheet thead th {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 8px;
    line-height: 1.2;
}
.version-form-page .table-color-sheet tbody td {
    padding: 6px 8px;
    font-size: 14px;
}
.version-form-page .table-color-sheet .td-color-name,
.version-form-page .table-color-sheet .th-col-name {
    min-width: 150px;
    width: auto;
    box-sizing: border-box;
}
.version-form-page .table-color-sheet .td-color-code,
.version-form-page .table-color-sheet .th-col-code {
    min-width: 150px;
    width: auto;
    box-sizing: border-box;
}
.version-form-page .table-color-sheet .color-sheet-hex-cell,
.version-form-page .table-color-sheet .th-col-hex,
.version-form-page .table-color-sheet .color-sheet-archive-cell,
.version-form-page .table-color-sheet .th-col-archive {
    min-width: 220px;
    width: auto;
    box-sizing: border-box;
}
.version-form-page .table-color-sheet .color-sheet-archive-cell {
    padding: 4px 8px !important;
    vertical-align: middle !important;
}
.version-form-page .table-color-sheet .color-sheet-archive-cell .pantone-code {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
}
.version-form-page .table-color-sheet .color-sheet-hex-cell {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 8px !important;
    white-space: nowrap;
}
.version-form-page .table-color-sheet .td-color-actions,
.version-form-page .table-color-sheet .th-color-actions {
    width: 1%;
    min-width: 52px;
    max-width: 64px;
    white-space: nowrap;
    box-sizing: border-box;
}

/* 名称/色号：铺满单元格，避免固定像素与窄表冲突 */
.version-form-page .table-color-sheet input.form-control.color-sheet-inp-name,
.version-form-page .table-color-sheet input.form-control.color-sheet-inp-code {
    display: block !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 8px !important;
    line-height: 30px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
}

.version-form-page .table-color-sheet .color-sheet-hex-cell > input {
    margin: 0 !important;
    flex-shrink: 0;
}
.version-form-page .table-color-sheet .color-swatch {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 1px solid #ced4da;
    border-radius: 2px;
    box-sizing: border-box;
}
.version-form-page .table-color-sheet .color-picker-input {
    display: block;
    width: 32px;
    height: 28px;
    padding: 0;
    border: 0;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
}
.version-form-page .table-color-sheet input.form-control.hex-code-field {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
    max-width: 9rem !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 6px !important;
    line-height: 28px !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
    flex: 0 0 auto;
}

/* Sheet2 尺码表：保持原逻辑，不与 Sheet1 混用宽度 */
.version-form-page .table-size-sheet th,
.version-form-page .table-size-sheet td {
    text-align: center !important;
    vertical-align: middle !important;
}
.version-form-page .table-size-sheet input {
    display: block !important;
    margin: 0 auto !important;
}
.version-form-page .table-size-sheet .td-color-name,
.version-form-page .table-size-sheet .td-color-code {
    width: auto;
    min-width: 80px;
}
.version-form-page .table-size-sheet input.form-control.color-sheet-inp-name {
    width: 160px !important;
    max-width: 160px !important;
    min-width: 160px !important;
}
.version-form-page .table-size-sheet input.form-control.color-sheet-inp-code {
    width: 100px !important;
    max-width: 100px !important;
    min-width: 100px !important;
}
.version-form-page .table-size-sheet .color-sheet-hex-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.version-form-page .table-size-sheet .color-swatch {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 1px solid #ced4da;
    border-radius: 2px;
    margin: 0;
    box-sizing: border-box;
}
.version-form-page .table-size-sheet .color-picker-input {
    display: block;
    width: 40px;
    height: 28px;
    padding: 0;
    border: 0;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    box-sizing: border-box;
}
.version-form-page .table-size-sheet input.form-control.hex-code-field {
    width: 120px !important;
    max-width: 120px !important;
    min-width: 72px !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
}
.version-form-page .table-size-sheet .td-color-actions,
.version-form-page .table-size-sheet .th-color-actions {
    width: 50px;
    min-width: 50px;
    text-align: center;
    white-space: nowrap;
}

/* 删除：50×30 扁平淡色、横向 */
.version-form-page .table-color-sheet button.btn-color-sheet-del,
.version-form-page .table-size-sheet button.btn-color-sheet-del {
    width: 50px !important;
    height: 30px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 30px !important;
    box-sizing: border-box !important;
    border: 1px solid #e5e7eb !important;
    color: #6b7280 !important;
    background: #f9fafb !important;
    border-radius: 2px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    text-align: center !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    margin: 0 auto !important;
}
.version-form-page .table-color-sheet button.btn-color-sheet-del:hover,
.version-form-page .table-size-sheet button.btn-color-sheet-del:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}

/* 仅隐藏版单页误用的固定角按钮，勿用全局选择器屏蔽 .btn-success */
.version-form-page .fixed-bottom-right,
.version-form-page .btn-fixed {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Sheet2 尺码表：粘贴区容器（左对齐、与右上角基准条错开） */
.version-form-page .size-paste-container {
    max-width: 800px;
    margin-left: 0;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}
.version-form-page .size-paste-label {
    align-self: flex-start;
}
.version-form-page .size-paste-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
}
.version-form-page #size-paste-zone.form-control,
.version-form-page #size-paste-zone.paste-zone {
    min-height: 220px;
    font-size: 14px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.version-form-page .size-sheet-status.is-ok {
    color: #15803d;
    margin-bottom: 0;
}
.version-form-page .size-sheet-status.is-err {
    color: #b91c1c;
    margin-bottom: 0;
}

/* Sheet2 v2：多命名尺寸表列表 + 右键插入行列 */
#pane-s2 .size-chart-list-panel {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
#pane-s2 .size-chart-name-list .size-chart-name-row {
    padding: 0.35rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
#pane-s2 .size-chart-name-link {
    font-size: 14px;
    font-weight: 500;
    color: #2563eb;
}
#pane-s2 .size-list-toolbar,
#pane-s2 .size-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
#pane-s2 #size-chart-ctx-menu.size-chart-ctx-menu {
    position: fixed;
    z-index: 1060;
    min-width: 10rem;
    padding: 0.35rem 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
    display: none;
}
#pane-s2 #size-chart-ctx-menu.size-chart-ctx-menu.is-open {
    display: flex;
    flex-direction: column;
}
#pane-s2 .size-chart-ctx-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
#pane-s2 .size-chart-ctx-item:hover {
    background: #f9fafb;
}

/* Sheet3 配比矩阵：横向滚动 + 表头/首列粘性（与 ui_tables.standard-table 协同） */
.version-form-page .erp-table-scroll.ratio-matrix-scroll-wrap {
    overflow: auto;
    max-width: 100%;
    max-height: min(70vh, 720px);
    -webkit-overflow-scrolling: touch;
}
.version-form-page .table-ratio-matrix {
    --ratio-matrix-col-w: 5.5rem;
    --ratio-matrix-col-min: 4.5rem;
    --ratio-matrix-col-max: 6.5rem;
    border-collapse: separate;
    border-spacing: 0;
    /* max-content：避免 table-layout:fixed + width:auto + min-width:0 在部分环境下把表算成不可见 */
    width: max-content;
    max-width: 100%;
    table-layout: fixed;
    background: #fff;
}
/* 覆盖 standard-table 大格：配比表以数字为主，收紧 padding / 行高 */
.version-form-page .table-ratio-matrix.standard-table th,
.version-form-page .table-ratio-matrix.standard-table td {
    padding: 4px 6px;
    height: auto;
    min-height: 0;
    line-height: 1.25;
    font-size: 13px;
}
.version-form-page .table-ratio-matrix thead th.ratio-sticky-top {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f1f5f9;
    box-shadow: inset 0 -1px 0 #e2e8f0;
}
.version-form-page .table-ratio-matrix th.ratio-sticky-col,
.version-form-page .table-ratio-matrix td.ratio-color-label {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8fafc;
    box-shadow: inset -1px 0 0 #e2e8f0;
}
/* 首列（角格/颜色名）与尺码列、合计列统一宽度，视觉对齐 */
.version-form-page .table-ratio-matrix thead th.ratio-corner {
    left: 0;
    z-index: 4;
    background: #e2e8f0;
    width: var(--ratio-matrix-col-w);
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix th.ratio-color-label,
.version-form-page .table-ratio-matrix td.ratio-color-label {
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    width: var(--ratio-matrix-col-w);
    text-align: center;
    font-weight: 600;
    padding: 4px 6px;
    vertical-align: middle;
    white-space: normal;
    word-break: break-all;
    box-sizing: border-box;
}
/* 尺码列：与首列同宽 */
.version-form-page .table-ratio-matrix thead th.ratio-size-head {
    width: var(--ratio-matrix-col-w);
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    padding: 4px 6px;
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix .ratio-cell {
    width: var(--ratio-matrix-col-w);
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    padding: 4px 6px;
    vertical-align: middle;
    text-align: center;
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix .ratio-input {
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 28px;
    min-height: 28px;
    padding: 2px 4px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix .ratio-row-sum-head,
.version-form-page .table-ratio-matrix .ratio-row-sum,
.version-form-page .table-ratio-matrix .ratio-col-sum,
.version-form-page .table-ratio-matrix .ratio-corner-sum {
    width: var(--ratio-matrix-col-w);
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    padding: 4px 6px;
    text-align: center;
    font-size: 13px;
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix tfoot th.ratio-sticky-col:first-child {
    width: var(--ratio-matrix-col-w);
    min-width: var(--ratio-matrix-col-min);
    max-width: var(--ratio-matrix-col-max);
    box-sizing: border-box;
}
.version-form-page .table-ratio-matrix tfoot td,
.version-form-page .table-ratio-matrix tfoot th {
    background: #f1f5f9;
    font-weight: 600;
}
.version-form-page .ratio-matrix-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.version-form-page .ratio-matrix-toolbar .ratio-total-input {
    min-width: 6rem;
    font-weight: 600;
    text-align: right;
}

/* ==================== Sheet5 BOM：视图切换 + 录入弹窗 + 类别 Badge ==================== */
.version-form-page .bom-sheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 10px;
}
.version-form-page .bom-view-toggle-group {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}
.version-form-page .bom-view-btn {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    line-height: 1.2;
}
.version-form-page .bom-view-btn + .bom-view-btn {
    border-left: 1px solid #dee2e6;
}
.version-form-page .bom-view-btn:hover {
    background: #e9ecef;
}
.version-form-page .bom-view-btn.active {
    background: #667eea;
    color: #fff;
    font-weight: 600;
}
.version-form-page .bom-view-panel {
    margin-top: 4px;
}
.version-form-page .bom-view-hint {
    margin: 8px 0;
    font-size: 14px;
}
.version-form-page .bom-item-modal-content {
    min-width: min(720px, 96vw);
    max-width: 920px;
}
.version-form-page .bom-item-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.version-form-page .bom-item-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}
.version-form-page .bom-item-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    padding: 0 4px;
}
.version-form-page .bom-item-modal-close:hover {
    color: #374151;
}
.version-form-page .bom-item-modal-hint {
    font-size: 13px;
    margin: 0 0 12px;
}
.version-form-page .bom-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
}
.version-form-page .bom-modal-field-span2 {
    grid-column: 1 / -1;
}
.version-form-page .bom-modal-field label,
.version-form-page .bom-modal-label-block {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}
.version-form-page .bom-item-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
}
.version-form-page .bom-scope-check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fafafa;
    max-height: 160px;
    overflow: auto;
}
.version-form-page .bom-scope-check-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}
.version-form-page .bom-scope-check-row.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.version-form-page .bom-process-chain-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.version-form-page .bom-process-chain-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.version-form-page .bom-process-chain-row .bom-process-chain-inp {
    flex: 1;
    min-width: 0;
}
.version-form-page .bom-btn-add-chain {
    margin-top: 4px;
}
/* 成品蓝 / 坯布橙 / 辅料绿 */
.version-form-page .bom-cat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.version-form-page .bom-cat-badge-fabric {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}
.version-form-page .bom-cat-badge-greige {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fdba74;
}
.version-form-page .bom-cat-badge-trims {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}
.version-form-page .bom-board-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.version-form-page .bom-board-color-table .bom-board-color-name {
    vertical-align: middle;
    font-weight: 600;
    background: #f8fafc;
    white-space: nowrap;
}
.version-form-page .bom-board-size-matrix .bom-mat-col {
    min-width: 120px;
    max-width: 220px;
    text-align: left;
    white-space: nowrap;
}
.version-form-page .bom-material-table .bom-col-spec-trio {
    font-size: 13px;
    max-width: 140px;
}

/* BOM 按物料列表：宽屏撑开、12px 密排、三列 sticky（# / 类别 / 物料） */
.version-form-page .bom-bom-list-shell {
    width: 100%;
}
@media (min-width: 1200px) {
    .version-form-page .bom-bom-list-shell {
        overflow-x: visible;
    }
}
@media (max-width: 1199.98px) {
    .version-form-page .bom-bom-list-shell {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
.version-form-page .bom-material-table.bom-material-table-dense {
    width: max-content;
    min-width: 100%;
    font-size: 12px;
    table-layout: auto;
}
.version-form-page .bom-material-table.bom-material-table-dense th,
.version-form-page .bom-material-table.bom-material-table-dense td {
    font-size: 12px;
    padding: 0.25rem 0.4rem;
    vertical-align: middle;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-idx,
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-cat,
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-mat {
    position: sticky;
    z-index: 2;
    background: #fff;
    box-shadow: 2px 0 3px rgba(15, 23, 42, 0.08);
}
.version-form-page .bom-material-table.bom-material-table-dense thead th.bom-mat-sticky-idx,
.version-form-page .bom-material-table.bom-material-table-dense thead th.bom-mat-sticky-cat,
.version-form-page .bom-material-table.bom-material-table-dense thead th.bom-mat-sticky-mat {
    z-index: 3;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-idx {
    left: 0;
    min-width: 2.25rem;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-cat {
    left: 2.25rem;
    min-width: 4.5rem;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-mat-sticky-mat {
    left: 6.75rem;
    min-width: 9rem;
    max-width: 14rem;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-cell-stack {
    line-height: 1.35;
    white-space: normal;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-col-scope {
    max-width: 240px;
}
.version-form-page .bom-scope-badges-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    max-width: 220px;
    max-height: 3.6em;
    overflow: hidden;
}
.version-form-page .bom-scope-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 0.15em 0.45em;
}
.version-form-page .bom-material-table.bom-material-table-dense .bom-cell-process-req {
    color: #b45309;
    font-weight: 600;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1.3;
}

/* BOM 弹窗：大号 modal-lg + 分组卡片 + Select2 + 底部成本条（整壳 flex 列，正文区单独滚动） */
.version-form-page .bom-item-modal-content.bom-modal-lg {
    min-width: min(960px, 98vw);
    max-width: 1100px;
    max-height: min(92vh, 920px);
    min-height: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
}
/* 非 BOM 物料行弹窗的通用 bom-modal-body（若存在）；物料弹窗用下方 .bom-item-modal-root 覆盖 */
.version-form-page .bom-modal-body {
    overflow-y: auto;
    max-height: min(70vh, 680px);
    flex: 1;
    min-height: 0;
    padding-right: 2px;
}
.version-form-page .bom-modal-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.version-form-page .bom-card {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
}
.version-form-page .bom-card-head {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}
.version-form-page .bom-card-ico {
    margin-right: 4px;
}
.version-form-page .bom-card-body {
    padding: 10px 12px;
}
.version-form-page .bom-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    align-items: start;
}
.version-form-page .bom-card .bom-modal-field-span2 {
    grid-column: 1 / -1;
}
.version-form-page .bom-label-req::after {
    content: " *";
    color: #c53030;
    font-weight: 700;
    opacity: 0.9;
}
.version-form-page .bom-temp-badge {
    display: inline-block;
    margin-left: 8px;
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 4px;
}
.version-form-page .bom-material-select2 + .select2-container {
    width: 100% !important;
}
.version-form-page .bom-item-modal-root .select2-container {
    z-index: 1060;
}
.version-form-page .bom-item-modal-root .select2-container .select2-selection--single {
    height: 30px;
    min-height: 30px;
    padding-top: 2px;
}
.version-form-page .bom-item-modal-root .select2-container .select2-selection__rendered {
    line-height: 26px;
    font-size: 14px;
}
.version-form-page .bom-item-modal-root .select2-container .select2-selection__arrow {
    height: 28px;
}
.version-form-page .bom-scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px 10px;
}
.version-form-page .bom-scope-check-row.is-picked {
    background: #eff6ff;
    border-radius: 4px;
    padding: 4px 8px;
    margin: -4px -8px;
}
.version-form-page .bom-modal-total-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 4px 8px;
    margin-top: 6px;
    border-top: 2px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.version-form-page .bom-modal-total-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}
.version-form-page .bom-modal-total-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #15803d;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.version-form-page .bom-modal-total-hint {
    font-size: 12px;
    flex: 1 1 200px;
}
.version-form-page .bom-total-manual-input {
    max-width: 140px;
    display: inline-block;
    vertical-align: middle;
}
.version-form-page .bom-total-edit-toggle {
    padding: 0 6px;
    font-size: 13px;
}

/* BOM 弹窗正文区滚动：与下方「定稿」规则合并，避免 max-height 互相覆盖 */
.version-form-page .bom-modal-compact {
    font-size: 12px;
}
.bom-item-modal-root .bom-modal-compact .row[class*="bom-bom-row-"] {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0.85rem;
    margin-bottom: 0.5rem;
}
.bom-item-modal-root .bom-modal-compact .form-label-sm {
    margin-bottom: 0.3rem;
    font-size: 13px;
    line-height: 1.25;
}
.bom-item-modal-root .bom-modal-compact .form-control-sm,
.bom-item-modal-root .bom-modal-compact .form-select-sm,
.bom-item-modal-root .bom-modal-compact .select2-container .select2-selection--single {
    min-height: 36px;
    height: 36px;
}
.bom-item-modal-root .bom-bom-row-1 .col-md-4,
.bom-item-modal-root .bom-bom-row-1 .col-md-6,
.bom-item-modal-root .bom-bom-row-2 > [class*="col-"],
.bom-item-modal-root .bom-bom-row-3 > [class*="col-"] {
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
}
.bom-item-modal-root .bom-bom-row-2 .bom-h-row-material {
    min-width: 260px;
}
.bom-item-modal-root .bom-m-spec-section .row.g-2 {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.65rem;
}
.bom-item-modal-root .bom-chain-temp-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.15rem;
    margin-bottom: 0.25rem;
}
.bom-item-modal-root .bom-chain-temp-label input {
    margin: 0;
}
.bom-item-modal-root .bom-modal-compact .bom-field-block {
    margin-bottom: 0.1rem;
}
@media (max-width: 991.98px) {
    .bom-item-modal-root .bom-bom-row-2 .bom-h-row-material {
        min-width: 0;
    }
}

/* BOM 弹窗：横向优先 + 正文区可滚动（内容超出必出滚动条） */
.version-form-page .bom-item-modal-root .bom-modal-body,
.bom-item-modal-root .bom-modal-body {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: min(72vh, calc(92vh - 200px));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    padding-right: 8px;
}

/*
 * 物料行录入：以「弹窗内容区」宽度为基准（容器查询），不依赖整页/iframe 视口 ≥768px。
 * 否则抽屉、窄 iframe 下 @media (min-width: 768px) 永不命中，Bootstrap col-12 会整列竖排，观感极差。
 */
.version-form-page .bom-item-modal-content.bom-modal-lg,
.bom-item-modal-root .bom-item-modal-content.bom-modal-lg {
    container-type: inline-size;
    container-name: bom-item-modal;
}

@container bom-item-modal (min-width: 300px) {
    #bomItemModal .bom-bom-row-1.bom-row1--three {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
        column-gap: 0.75rem;
        row-gap: 0.5rem;
    }
    #bomItemModal .bom-bom-row-1.bom-row1--two {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
        column-gap: 0.75rem;
        row-gap: 0.5rem;
    }
    #bomItemModal .bom-bom-row-1.bom-row1--three > [class*="col-"],
    #bomItemModal .bom-bom-row-1.bom-row1--two > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
}

@container bom-item-modal (min-width: 400px) {
    #bomItemModal .bom-bom-row-2 {
        display: grid;
        grid-template-columns: minmax(160px, 1.2fr) minmax(64px, 0.45fr) minmax(180px, 1.65fr);
        align-items: end;
        column-gap: 0.85rem;
        row-gap: 0.55rem;
    }
    #bomItemModal .bom-bom-row-2 > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
}

@container bom-item-modal (min-width: 360px) {
    #bomItemModal .bom-bom-row-3 {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
        column-gap: 0.65rem;
        row-gap: 0.55rem;
    }
    #bomItemModal .bom-bom-row-3 > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
}

@container bom-item-modal (min-width: 720px) {
    #bomItemModal .bom-bom-row-3 {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        column-gap: 0.75rem;
    }
}

@media (min-width: 768px) {
    .version-form-page .bom-item-modal-root .bom-bom-row-1.bom-row1--three {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
        column-gap: 1rem;
        row-gap: 0.65rem;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-1.bom-row1--two {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
        column-gap: 1rem;
        row-gap: 0.65rem;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-1.bom-row1--three > [class*="col-"],
    .version-form-page .bom-item-modal-root .bom-bom-row-1.bom-row1--two > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-2 {
        display: grid;
        grid-template-columns: minmax(200px, 1.25fr) minmax(72px, 0.55fr) minmax(260px, 2.2fr);
        align-items: end;
        column-gap: 1rem;
        row-gap: 0.65rem;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-2 > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-3 {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        align-items: end;
        column-gap: 0.65rem;
        row-gap: 0.65rem;
    }
    .version-form-page .bom-item-modal-root .bom-bom-row-3 > [class*="col-"] {
        width: 100%;
        max-width: none;
        flex: none;
    }
}

.version-form-page .bom-item-modal-root .bom-bom-row-1 .form-control.form-control-sm,
.version-form-page .bom-item-modal-root .bom-bom-row-1 .form-select.form-select-sm {
    min-height: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    box-shadow: none;
}
.version-form-page .bom-bom-card {
    margin-bottom: 0;
}
.version-form-page .bom-sm-card {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.version-form-page .bom-sm-card .bom-sm-card-header,
.version-form-page .bom-bom-card > .card-header.bom-sm-card-header {
    font-size: 12px;
    font-weight: 700;
    color: #1e3a5f;
    background: linear-gradient(180deg, #e8f4fc 0%, #dbeafe 100%);
    border-bottom: 1px solid #bfdbfe;
}
.version-form-page .bom-h-row {
    min-height: 28px;
}
.version-form-page .bom-h-row .col-form-label-sm {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    line-height: 1.2;
}
.version-form-page .bom-h-row-material .bom-material-select-wrap {
    width: 100%;
}
.version-form-page .bom-settlement-card {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    min-width: 168px;
    box-shadow: inset 0 1px 0 #fff;
}
.version-form-page .bom-settlement-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.version-form-page .bom-footer-main-row {
    align-items: flex-end !important;
}
.version-form-page .bom-modal-total-hint-wrap {
    min-width: 0;
}
.version-form-page #bomItemModal.bom-cat-trims #bom-m-spec-section {
    display: none !important;
}
.version-form-page .bom-modal-group {
    margin-bottom: 0;
}
.version-form-page .bom-modal-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    border-radius: 2px;
    border: 1px solid #e9ecef;
}
.version-form-page .bom-field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}
.version-form-page .bom-field-inline-material {
    align-items: flex-start;
}
.version-form-page .bom-field-inline-material .bom-field-label {
    padding-top: 4px;
}
.version-form-page .bom-field-label {
    flex: 0 0 72px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-align: right;
    line-height: 1.2;
}
.version-form-page .bom-field-control,
.version-form-page .bom-item-modal-root .bom-field-control {
    height: 30px;
    min-height: 30px;
    font-size: 14px;
    padding-top: 4px;
    padding-bottom: 4px;
}
.version-form-page textarea.bom-field-control {
    height: auto;
    min-height: 60px;
}
.version-form-page .bom-material-select-wrap {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.version-form-page .bom-material-select-wrap .select2-container {
    flex: 1 1 160px;
    min-width: 0;
}
.version-form-page .bom-greige-suppliers-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.version-form-page .bom-chain-temp-label {
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.version-form-page .bom-chain-temp-label input {
    margin-right: 6px;
    vertical-align: middle;
}
.version-form-page .bom-modal-footer-erp {
    flex-shrink: 0;
    background: #fafbfc;
}
.version-form-page .bom-item-modal-root .bom-modal-footer-erp.bom-modal-footer-actions-only {
    padding-top: 4px;
    padding-bottom: 4px;
}
.version-form-page .bom-item-modal-root .bom-modal-footer-erp.bom-modal-footer-actions-only .bom-item-modal-actions {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.version-form-page .bom-est-cost-hero {
    font-size: 1.5rem;
    font-weight: 800;
    color: #15803d;
    line-height: 1.15;
    letter-spacing: 0.03em;
}
.version-form-page .bom-field-error,
.version-form-page .bom-field-control.bom-field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.25);
}

/* BOM 弹窗：加工模式专用视觉标记 */
#bomItemModal[data-material-lib-subcat="dyeing"],
#bomItemModal[data-material-lib-subcat="process"] {
    border-top: 5px solid #ffc107; /* 橙色提醒：这是加工服务 */
}

/* 隐藏不必要的字段：当 subcat 是加工类时，隐藏幅宽克重 */
#bomItemModal[data-material-lib-subcat="dyeing"] .bom-modal-spec-group,
#bomItemModal[data-material-lib-subcat="process"] .bom-modal-spec-group {
    display: none !important;
}

/* BOM 弹窗：紧凑行距 + 抵消 admin-modal 对 .card 去边框（分组卡片须可见） */
.version-form-page .bom-item-modal-root .bom-card-body-tight {
    padding-top: 8px;
    padding-bottom: 8px;
}
.version-form-page .bom-item-modal-root .bom-card-body-tight .form-label-sm,
.version-form-page .bom-item-modal-root .bom-m-maincat-row .form-label-sm {
    margin-bottom: 2px;
    line-height: 1.25;
}
.version-form-page .bom-item-modal-root .bom-bom-field-stack .bom-field-block {
    margin-bottom: 8px;
}
.version-form-page .bom-item-modal-root .bom-bom-field-stack .form-label-sm {
    margin-bottom: 4px;
    display: block;
}
.version-form-page .bom-item-modal-root .bom-card {
    margin-bottom: 8px;
}
.bom-item-modal-root.admin-modal .card.bom-sm-card.bom-bom-card {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    background: #fff;
}
.bom-item-modal-root.admin-modal .card.bom-sm-card.bom-bom-card .card-header {
    border-bottom: 1px solid #bfdbfe;
}

/* 列表展示：给子分类打上 Badge */
.badge-subcat-finished { background-color: #e3f2fd; color: #0d47a1; }
.badge-subcat-greige { background-color: #fff3e0; color: #e65100; }
.badge-subcat-dyeing { background-color: #f3e5f5; color: #4a148c; }

/* Sheet6 工序库选择弹窗：结果区滚动，避免小屏占满视口 */
.version-form-page .process-pick-modal .process-pick-modal-content {
    width: min(720px, 96vw);
}
.version-form-page .process-pick-modal .process-pick-results-wrap {
    max-height: 260px;
    overflow: auto;
}
.version-form-page .process-pick-modal .process-pick-row {
    cursor: pointer;
}
.version-form-page .process-pick-modal .process-pick-row:hover {
    background: #f8fafc;
}

/* Sheet6 工价表：限制机器类型/选择工序列宽，保证工价列可读 */
.version-form-page .sheet-process-table {
    table-layout: fixed;
    width: 100%;
}
.version-form-page .sheet-process-table thead th:nth-child(1),
.version-form-page .sheet-process-table tbody td:nth-child(1) {
    width: 6.25rem;
    max-width: 7rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(2),
.version-form-page .sheet-process-table tbody td:nth-child(2) {
    width: 5.5rem;
    max-width: 6.25rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(3),
.version-form-page .sheet-process-table tbody td:nth-child(3) {
    width: 5rem;
    max-width: 5.5rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(4),
.version-form-page .sheet-process-table tbody td:nth-child(4) {
    width: 9.5rem;
    max-width: 11rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(5),
.version-form-page .sheet-process-table tbody td:nth-child(5) {
    width: 4.75rem;
    max-width: 5.25rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(6),
.version-form-page .sheet-process-table tbody td:nth-child(6) {
    width: 6.5rem;
    max-width: 7.5rem;
    min-width: 0;
}
.version-form-page .sheet-process-table thead th:nth-child(7),
.version-form-page .sheet-process-table tbody td:nth-child(7) {
    width: 7.5rem;
    min-width: 7rem;
    max-width: 9rem;
}
.version-form-page .sheet-process-table thead th:nth-child(8),
.version-form-page .sheet-process-table tbody td:nth-child(8) {
    width: 3.25rem;
    max-width: 4rem;
    min-width: 0;
}
.version-form-page .sheet-process-table td:nth-child(1) .proc-style-type,
.version-form-page .sheet-process-table td:nth-child(2) .proc-process-type,
.version-form-page .sheet-process-table td:nth-child(3) .proc-machine-type,
.version-form-page .sheet-process-table td:nth-child(4) .proc-library-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}
.version-form-page .sheet-process-table .proc-code,
.version-form-page .sheet-process-table .proc-name,
.version-form-page .sheet-process-table .proc-unit-price {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}
.version-form-page .sheet-process-table td:nth-child(6) .proc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.version-form-page .sheet-process-table td.proc-library-cell {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}
/* Sheet6 操作列：删除为小标签样式，单行横向展示 */
.version-form-page .sheet-process-table td.proc-op-cell {
    white-space: nowrap;
    vertical-align: middle;
}
.version-form-page .sheet-process-table .btn-del-process-tag {
    display: inline-block;
    margin: 0;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 500;
    color: #b91c1c;
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.version-form-page .sheet-process-table .btn-del-process-tag:hover {
    background: #fef2f2;
    border-color: #f87171;
    color: #991b1b;
}

/* Sheet7 成本核算：固定左列（成本项）+ 数据列居中 + 与「按尺码」一致的网格线 */
.version-form-page .costing-matrix-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
}
.version-form-page .sheet-costing-table {
    min-width: 420px;
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.version-form-page .sheet-costing-table caption {
    caption-side: top;
    padding: 0.35rem 0.5rem 0.5rem;
}
.version-form-page .sheet-costing-table > thead > tr > th,
.version-form-page .sheet-costing-table > tbody > tr > th,
.version-form-page .sheet-costing-table > tbody > tr > td,
.version-form-page .sheet-costing-table > tfoot > tr > th {
    border: 1px solid #cbd5e1;
    vertical-align: middle;
    padding: 0.45rem 0.5rem;
}
.version-form-page .sheet-costing-table .costing-col-label {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 10rem;
    min-width: 10rem;
    max-width: 10rem;
    box-sizing: border-box;
    text-align: center;
    font-weight: 600;
    background: #f1f5f9;
    color: #1e293b;
    border-right: 2px solid #94a3b8 !important;
}
.version-form-page .sheet-costing-table thead .costing-col-label {
    z-index: 4;
    background: #e2e8f0;
}
.version-form-page .sheet-costing-table tfoot .costing-col-label {
    z-index: 3;
    background: #e2e8f0;
}
.version-form-page .sheet-costing-table .costing-col-data {
    min-width: 4.25rem;
    text-align: center;
}
.version-form-page .sheet-costing-table tbody td.costing-col-data {
    color: #475569;
}
.version-form-page .sheet-costing-table tfoot th.costing-col-data {
    color: #0f172a;
}
/* BOM Sheet5：按母料系数时「用量」只读灰底（JS 可附加 .bom-unit-usage-readonly 或设 readonly） */
.version-form-page .bom-item-modal-root #bom-m-unit-usage.bom-unit-usage-readonly,
.version-form-page .bom-item-modal-root #bom-m-unit-usage[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* ========== 版单模块轻量页：默认只读 + 编辑门禁；返回工作台按钮强调 ========== */
.jiayu-module-sheet-gate[data-sheet-locked="1"] #sheetPanes[inert],
.jiayu-module-sheet-gate.module-lite-page--viewing #sheetPanes[inert] {
    border-radius: 8px;
    background-color: #f3f4f6;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}
.jiayu-module-sheet-gate[data-sheet-locked="1"] #sheetPanes[inert] input,
.jiayu-module-sheet-gate[data-sheet-locked="1"] #sheetPanes[inert] select,
.jiayu-module-sheet-gate[data-sheet-locked="1"] #sheetPanes[inert] textarea,
.jiayu-module-sheet-gate.module-lite-page--viewing #sheetPanes[inert] input,
.jiayu-module-sheet-gate.module-lite-page--viewing #sheetPanes[inert] select,
.jiayu-module-sheet-gate.module-lite-page--viewing #sheetPanes[inert] textarea {
    background-color: #e5e7eb !important;
    color: #6b7280 !important;
}
a.btn-module-lite-back,
a.btn.btn-module-lite-back {
    background-color: #eff6ff !important;
    border-color: #2563eb !important;
    color: #1d4ed8 !important;
    font-weight: 600 !important;
}
a.btn-module-lite-back:hover,
a.btn.btn-module-lite-back:hover {
    background-color: #dbeafe !important;
    border-color: #1d4ed8 !important;
    color: #1e3a8a !important;
}

/* ========== BOM 按物料：左 4 列 + 中间横向滚动 + 右 4 列固定 ========== */
/* 档案行：仅在整页只读（锁版单 / 工作台浏览态）时淡化行底；可编辑时与新行一致 */
.version-form-page[data-sheet-locked="1"] .bom-material-table-split tbody tr.bom-row--from-archive > td,
.jiayu-module-sheet-gate.module-lite-page--viewing .bom-material-table-split tbody tr.bom-row--from-archive > td,
body.is-locked .bom-material-table-split tbody tr.bom-row--from-archive > td {
    background-color: #f8fafc !important;
}
.bom-material-table-split tbody tr.bom-row--from-archive .bom-archive-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 500;
    color: #475569;
    background: #e2e8f0;
    border-radius: 4px;
    vertical-align: middle;
    white-space: nowrap;
}
.bom-material-table-split tbody tr.bom-row--from-archive .btn-bom-peise:disabled,
.bom-material-table-split tbody tr.bom-row--from-archive .btn-bom-peima:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.version-form-page .bom-split-table-root {
    position: relative;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    overflow: hidden;
}
.version-form-page .bom-split-x-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
.version-form-page .bom-material-table-split {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    table-layout: fixed;
}
.version-form-page .bom-material-table-split th,
.version-form-page .bom-material-table-split td {
    padding: 0.3rem 0.35rem;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
    box-sizing: border-box;
}
.version-form-page .bom-material-table-split thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.version-form-page .bom-material-table-split .bom-split-mid-cell {
    min-width: 4.5rem;
}
.version-form-page .bom-material-table-split .bom-split-mid-cell--wide {
    min-width: 7rem;
}
.version-form-page .bom-material-table-split .bom-split-mid-cell--spec {
    min-width: 6.5rem;
}
.version-form-page .bom-material-table-split .bom-split-mid-cell--peibi {
    min-width: 5.5rem;
}
.version-form-page .bom-material-table-split .bom-split-mid-cell--usage {
    min-width: 5.75rem;
}
.version-form-page .bom-material-table-split input.bom-inline-unit-usage {
    max-width: 7rem;
    text-align: right;
}
.version-form-page .bom-material-table-split .form-control-sm,
.version-form-page .bom-material-table-split .form-select-sm {
    font-size: 12px;
    padding: 0.2rem 0.35rem;
    min-height: 30px;
    height: 30px;
}
.version-form-page .bom-material-table-split .select2-container {
    font-size: 12px;
}
.version-form-page .bom-material-table-split .select2-container .select2-selection--single {
    height: 30px;
    padding: 2px 6px;
}
.version-form-page .bom-material-table-split .select2-container .select2-selection__rendered {
    line-height: 24px;
    padding-left: 2px;
}
.version-form-page .bom-material-table-split .select2-container .select2-selection__arrow {
    height: 28px;
}
/* 左固定：序号 → 类型 → 名称 → 供应商 */
.version-form-page .bom-material-table-split .bom-lc1 {
    position: sticky;
    left: 0;
    z-index: 4;
    min-width: 2.5rem;
    width: 2.5rem;
    text-align: center;
    box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}
.version-form-page .bom-material-table-split .bom-lc2 {
    position: sticky;
    left: 2.5rem;
    z-index: 4;
    min-width: 5.5rem;
    width: 5.5rem;
    box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}
.version-form-page .bom-material-table-split .bom-lc3 {
    position: sticky;
    left: 8rem;
    z-index: 4;
    min-width: 11rem;
    width: 11rem;
    max-width: 11rem;
    box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}
.version-form-page .bom-material-table-split .bom-lc4 {
    position: sticky;
    left: 19rem;
    z-index: 4;
    min-width: 6.5rem;
    width: 6.5rem;
    max-width: 6.5rem;
    box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}
.version-form-page .bom-material-table-split thead th.bom-lc1,
.version-form-page .bom-material-table-split thead th.bom-lc2,
.version-form-page .bom-material-table-split thead th.bom-lc3,
.version-form-page .bom-material-table-split thead th.bom-lc4 {
    z-index: 5;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}
/* 右固定：总量 → 总价 → 操作（配色/配码/删除） */
.version-form-page .bom-material-table-split .bom-rc-ops {
    position: sticky;
    right: 0;
    z-index: 6;
    min-width: 7rem;
    width: 7rem;
    text-align: center;
    box-shadow: -2px 0 4px rgba(15, 23, 42, 0.06);
    background: #fff;
}
.version-form-page .bom-material-table-split .bom-rc2 {
    position: sticky;
    right: 7rem;
    z-index: 5;
    min-width: 4.25rem;
    width: 4.25rem;
    text-align: right;
    box-shadow: -2px 0 4px rgba(15, 23, 42, 0.06);
    background: #fff;
}
.version-form-page .bom-material-table-split .bom-rc1 {
    position: sticky;
    right: 11.25rem;
    z-index: 4;
    min-width: 4.25rem;
    width: 4.25rem;
    text-align: right;
    box-shadow: -2px 0 4px rgba(15, 23, 42, 0.06);
    background: #fff;
}
.version-form-page .bom-material-table-split thead th.bom-rc1,
.version-form-page .bom-material-table-split thead th.bom-rc2,
.version-form-page .bom-material-table-split thead th.bom-rc-ops {
    z-index: 7;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}
.version-form-page .bom-material-table-split .bom-cell-ro {
    display: inline-block;
    max-width: 10rem;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.version-form-page .bom-btn-peima {
    padding: 0.28rem 0.7rem;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    min-width: 3.25rem;
}
.version-form-page .bom-btn-peise {
    padding: 0.28rem 0.7rem;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    min-width: 3.25rem;
}
.version-form-page .bom-btn-del-icon {
    color: #9ca3af;
    padding: 0;
    min-width: 2rem;
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 999px;
}
.version-form-page .bom-btn-del-icon:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* 配色/配码弹窗：隐藏主录入块，保留配比方式 + 应用范围 + 工艺链 */
#bomItemModal.bom-modal--scope-only #bom-modal-primary-block {
    display: none !important;
}
#bomItemModal.bom-modal--scope-only .bom-item-modal-hint {
    display: none !important;
}
#bomItemModal.bom-modal--scope-only #bom-modal-save-add-next {
    display: none !important;
}

/* 版单列表（style_list）：锁定原因说明 */
.card-lock-reason {
    font-size: 12px;
    line-height: 1.4;
    color: #6b7280;
    margin: 6px 0 4px;
    padding: 6px 8px;
    background: #f3f4f6;
    border-radius: 6px;
}
.style-list-lock-reason {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #6b7280;
    max-width: 16rem;
}

/* 样衣制作列表：锁定角标与卡片弱化 */
.sample-card {
    position: relative;
}
.sample-card--locked {
    opacity: 0.92;
    filter: saturate(0.9);
}
.sample-card-lock-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.sample-card-lock-reason {
    margin-bottom: 6px;
}
