/* 新版组件样式。app.css 保留原有视觉，这里只补充新增部分。 */

a { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
textarea, select { font: inherit; }

/* ---------- 侧栏：链接形式的导航项 ---------- */
a.nav-item, a.workspace-switcher { text-decoration: none; }
.sub-nav a { position: relative; display: flex; min-height: 30px; align-items: center; justify-content: space-between; padding: 0 10px; color: #777d83; border-radius: 5px; font-size: 12px; text-decoration: none; }
.sub-nav a:hover { color: #343a40; background: #eceeef; }
.sub-nav a.is-active { color: var(--accent-dark); background: var(--accent-soft); font-weight: 500; }
.sub-nav a.is-active::before { position: absolute; top: 7px; bottom: 7px; left: -3px; width: 2px; border-radius: 2px; background: var(--accent); content: ""; }
.sub-nav a em { color: #a3a9ad; font-size: 10px; font-style: normal; }
.nav-group.is-open .sub-nav { max-height: 600px; }
.nav-item.is-disabled { color: #b0b5b9; cursor: help; }
.nav-item.is-disabled:hover { color: #b0b5b9; background: transparent; }
.nav-item.is-disabled .nav-icon { color: #c3c7ca; }
.nav-soon { padding: 1px 5px; color: #a3a9ad; border: 1px solid #e3e5e7; border-radius: 4px; font-size: 9px; font-style: normal; }
.sidebar.is-collapsed .nav-soon { display: none; }
.nav-group.is-admin-only { display: none; }
body.is-admin .nav-group.is-admin-only { display: block; }

.sidebar-footer { position: relative; }
.user-menu { position: absolute; right: 8px; bottom: 56px; left: 8px; z-index: 12; display: grid; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgba(28, 36, 42, .14); }
.user-menu button { min-height: 32px; padding: 0 10px; color: #4d545a; border-radius: 5px; background: transparent; text-align: left; font-size: 12px; }
.user-menu button:hover { background: #f1f3f4; }

/* ---------- 通用 ---------- */
.loading-state { display: grid; min-height: 240px; place-items: center; color: #9da4a8; font-size: 12px; }
.empty-state a { color: var(--accent); }
.code-text { color: #3b4247; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .95em; font-weight: 500; }
.danger-text { color: #c65e48 !important; }
.danger-text:hover { color: #a84430 !important; }
.primary-button.danger-button { background: #d0634c; }
.primary-button.danger-button:hover { background: #b24d38; }
.secondary-button.danger-outline { color: #c65e48; }
.secondary-button.danger-outline:hover { border-color: #efc6bc; background: #fdf3f1; }
.resource-tabs a { display: inline-flex; min-height: 38px; align-items: center; padding: 0 17px; color: #81888d; border-radius: 5px; font-size: 13px; text-decoration: none; white-space: nowrap; }
.resource-tabs a:hover { color: #4b5358; }
.resource-tabs a.is-active { color: #3b5f7b; background: #fff; box-shadow: 0 1px 2px rgba(24, 32, 38, .06); font-weight: 500; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #f2f3f4; }
.segmented button { min-height: 30px; padding: 0 12px; color: #81888d; border-radius: 5px; background: transparent; font-size: 12px; }
.segmented button.is-active { color: #3b5f7b; background: #fff; box-shadow: 0 1px 2px rgba(24, 32, 38, .06); font-weight: 500; }

.record-table .actions-heading { width: 1%; text-align: right; }
.record-table .row-actions { text-align: right; white-space: nowrap; }
.record-table .row-actions .text-button { margin: 0 0 0 12px; background: transparent; font-size: 12px; }
.record-table tr.is-inactive td { color: #a3a9ad; }
.self-tag { margin-left: 4px; padding: 1px 5px; color: var(--accent-dark); border-radius: 4px; background: var(--accent-soft); font-size: 10px; font-style: normal; }

/* ---------- 弹窗表单 ---------- */
.modal-card { max-height: calc(100vh - 48px); overflow-y: auto; }
.modal-card.modal-card-wide { width: min(760px, 100%); }
.form-field input, .form-field select { font-size: 13px; }
.form-field textarea { font-size: 13px; }
.field-hint { color: #a3a9ad; font-size: 11px; }
.required-mark { color: #d0634c; font-style: normal; }
.checkbox-line { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.checkbox-line input { width: auto; height: auto; }
.confirm-message { margin: 14px 0 4px; color: #4d545a; font-size: 14px; line-height: 1.7; }

/* ---------- 提示 ---------- */
.toast-host { position: fixed; top: 16px; left: 50%; z-index: 50; display: grid; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { min-width: 200px; max-width: 460px; padding: 10px 16px; color: #fff; border-radius: 8px; background: #2f7d5f; box-shadow: 0 10px 30px rgba(20, 30, 38, .18); font-size: 13px; text-align: center; transition: opacity .3s ease, transform .3s ease; }
.toast-error { background: #c65e48; }
.toast-info { background: #3b5f7b; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); }

/* ---------- 工作台 ---------- */
.metric-link { color: inherit; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease; }
.metric-link:hover { border-color: #cfe3f5; box-shadow: 0 4px 14px rgba(36, 144, 239, .08); }
.dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.roadmap { display: grid; gap: 4px; margin: 14px 0 0; padding: 0; list-style: none; }
.roadmap-step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px 6px; border-radius: 7px; }
.roadmap-step strong { color: #3b4247; font-size: 13px; font-weight: 500; }
.roadmap-step p { margin: 2px 0 0; color: #8b9297; font-size: 12px; }
.roadmap-index { display: grid; width: 26px; height: 26px; place-items: center; color: #9aa0a5; border: 1px solid var(--line); border-radius: 50%; font-size: 12px; }
.roadmap-step.is-done .roadmap-index { color: #fff; border-color: var(--success); background: var(--success); }
.roadmap-step.is-next { background: var(--accent-soft); }
.roadmap-step.is-next .roadmap-index { color: #fff; border-color: var(--accent); background: var(--accent); }
.activity-list { display: grid; margin: 12px 0 0; padding: 0; list-style: none; }
.activity-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.activity-list li span { overflow: hidden; color: #4d545a; text-overflow: ellipsis; white-space: nowrap; }
.activity-list li em { flex: none; color: #a3a9ad; font-style: normal; }

/* ---------- 产品档案 ---------- */
.profile-actions { display: flex; align-items: center; gap: 8px; }
.back-link { display: inline-block; margin-bottom: 8px; color: #8b9297; font-size: 12px; text-decoration: none; }
.back-link:hover { color: var(--accent-dark); }
.style-image-cover { position: absolute; top: 6px; left: 6px; padding: 2px 6px; color: #fff; border-radius: 4px; background: rgba(36, 144, 239, .85); font-size: 10px; }
.section-actions { display: flex; gap: 8px; }
.notes-view { min-height: 62px; color: #4d545a; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.custom-notes textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fff; line-height: 1.6; resize: vertical; }
.custom-notes textarea:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.edit-table { min-width: 0; }
.edit-table .piece-input { width: 100%; }
.colorway-card-heading span { display: flex; gap: 10px; }
.colorway-card-heading .text-button { margin: 0; background: transparent; }
.colorway-editor { margin-bottom: 16px; }
.notice-card { padding: 18px 20px; border: 1px solid #d7e8f7; border-radius: 8px; background: var(--accent-soft); }
.notice-card strong { color: #2c5a80; font-size: 14px; font-weight: 500; }
.notice-card p { margin: 8px 0 0; color: #58708a; font-size: 13px; line-height: 1.7; }
.image-lightbox-footer > span:last-child { display: flex; gap: 14px; }
.image-lightbox-footer .text-button { margin: 0; background: transparent; }

/* ---------- 产品档案列表（紧凑表格） ---------- */
.archive-status-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.archive-tab { height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #687076; font-size: 12px; cursor: pointer; }
.archive-tab:hover { background: #f5f7f8; }
.archive-tab span { margin-left: 3px; color: var(--faint); font-variant-numeric: tabular-nums; }
.archive-tab.is-active { border-color: #9fcdf5; background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.archive-tab.is-active span { color: var(--accent-dark); }
.archive-table td, .archive-table th { padding-top: 9px; padding-bottom: 9px; }
.archive-table .record-image-cell { width: 64px; }
.archive-table .record-image-preview, .archive-table .record-image-placeholder { width: 40px; height: 40px; border-radius: 6px; font-size: 13px; }
.archive-name { display: grid; gap: 2px; }
.archive-name small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.archive-code-mobile, .archive-category-mobile, .archive-status-mobile { display: none; }
.archive-table .row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.archive-table .row-actions .text-button { margin: 0 6px 0 0; }
.archive-more-toggle { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: #8b9297; font-size: 16px; line-height: 1; cursor: pointer; }
.archive-more-toggle:hover { background: #f2f3f4; color: #3b4247; }
/* 手机：款号、分类、配色、状态并进名称单元格，表格不横向滚动 */
@media (max-width: 720px) {
  .record-table.archive-table { min-width: 0; }
  .record-table.archive-table td, .record-table.archive-table th { white-space: normal; }
  .record-table.archive-table .col-code, .record-table.archive-table .col-category,
  .record-table.archive-table .col-num, .record-table.archive-table .col-status { display: none; }
  .record-table.archive-table .record-image-cell { width: 56px; }
  .record-table.archive-table .archive-code-mobile, .record-table.archive-table .archive-category-mobile { display: block; }
  .record-table.archive-table .archive-status-mobile { display: inline-flex; justify-self: start; }
  .record-table.archive-table .row-actions { white-space: nowrap; }
}

/* ---------- 登录页（左右分栏：左侧品牌面板，右侧表单） ---------- */
html:has(body.login-body) { min-width: 0; }
.login-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, 1fr); min-height: 100vh; margin: 0; background: #fff; }
.login-aside { position: relative; display: flex; flex-direction: column; padding: 44px 56px; overflow: hidden; color: #fff; background: #1768c4; }
.login-aside::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 44px); }
.login-aside > * { position: relative; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .brand-mark { color: var(--accent); background: #fff; }
.login-brand .brand-mark svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.85; }
.login-brand div { display: grid; line-height: 1.25; }
.login-brand strong { color: #fff; font-size: 15px; font-weight: 600; }
.login-brand span { color: rgba(255, 255, 255, .72); font-size: 12px; }
.login-pitch { max-width: 520px; margin: auto 0; }
.login-pitch h2 { margin: 0; font-size: 36px; font-weight: 600; line-height: 1.3; letter-spacing: .01em; }
.login-points { display: grid; gap: 14px; margin: 36px 0 0; padding: 0; list-style: none; }
.login-points li { display: flex; align-items: center; gap: 14px; color: rgba(255, 255, 255, .92); font-size: 15px; }
.login-points svg { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 8px; background: rgba(255, 255, 255, .14); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.login-main { display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; }
.login-main > * { width: min(380px, 100%); margin-left: auto; margin-right: auto; }
.login-section { margin-top: 24px; }
.login-title { margin: 0 0 20px; color: #1f2937; font-size: 24px; font-weight: 600; }
.login-main .form-field input { height: 44px; font-size: 14px; }
.login-error { min-height: 18px; margin: 0; color: #c65e48; font-size: 12px; }
.login-submit { justify-content: center; min-height: 44px; font-size: 15px; }
.login-foot { margin: 28px auto 0; color: #a3a9ad; font-size: 12px; text-align: center; }
@media (max-width: 959px) {
  .login-body { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .login-aside { padding: 18px 20px; }
  .login-pitch { display: none; }
  .login-main { justify-content: flex-start; padding: 28px 20px 40px; }
}

/* ---------- 通用补充 ---------- */
.muted { color: #9aa0a5; }
.warning-text { color: var(--warning); font-style: normal; }

/* ---------- 物料选择器 ---------- */
.picker-subtitle { margin: 4px 0 0; color: #8b9297; font-size: 12px; }
.picker-search { width: 100%; margin: 14px 0 10px; }
.picker-list { display: grid; max-height: 50vh; gap: 2px; overflow-y: auto; }
.picker-item { display: grid; grid-template-columns: 100px minmax(0, 1.4fr) minmax(0, 1fr) 120px; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; color: #4d545a; border-radius: 6px; background: transparent; text-align: left; font-size: 13px; }
.picker-item:hover { background: var(--accent-soft); }
.picker-item.is-current { background: #eef7ee; }
.picker-name, .picker-spec { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-spec { color: #9aa0a5; font-size: 12px; }
.picker-price { color: #4d545a; text-align: right; }
.picker-price em { color: var(--warning); font-style: normal; font-size: 12px; }
.picker-footer { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: #9aa0a5; font-size: 12px; }
.picker-footer .text-button { margin: 0; background: transparent; color: var(--accent); font-size: 13px; }
.picker-create { margin-top: 14px; }
.picker-create-title { margin: 0 0 12px; color: #687076; font-size: 12px; }

/* ---------- BOM算料 ---------- */
.bom-version-badge { display: inline-flex; align-items: center; padding: 2px 8px; color: #3b5f7b; border: 1px solid #cfe0ee; border-radius: 5px; background: #f4f9fd; font-size: 12px; font-weight: 600; }
.bom-header .profile-title-line { flex-wrap: wrap; gap: 10px; }
.bom-header-actions { display: flex; align-items: center; gap: 8px; }
.save-status { margin-right: 6px; color: #9aa0a5; font-size: 12px; }
.save-status .text-button { margin: 0; background: transparent; color: var(--accent); }
.save-failed { color: #c65e48; }
.bom-meta { display: grid; gap: 14px; }
.bom-product { display: flex; align-items: center; gap: 14px; }
.bom-product img, .bom-product-placeholder { width: 56px; height: 64px; flex: none; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.bom-product-placeholder { display: grid; place-items: center; color: #7d9aad; background: #f2f5f6; font-size: 20px; }
.bom-product > div { display: grid; gap: 4px; }
.bom-product strong { color: #3b4247; font-size: 14px; font-weight: 500; }
.bom-product .text-button { justify-self: start; margin: 0; background: transparent; font-size: 12px; text-decoration: none; }
.bom-colorway-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: #8b9297; font-size: 12px; }
.bom-colorway-list em { padding: 1px 7px; color: #4d545a; border-radius: 4px; background: #f2f3f4; font-style: normal; }
.bom-versions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: #8b9297; font-size: 12px; }
.bom-version-chip { padding: 3px 10px; color: #687076; border: 1px solid var(--line); border-radius: 14px; font-size: 12px; text-decoration: none; }
.bom-version-chip:hover { border-color: #b9d6ee; }
.bom-version-chip.is-current { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }
.bom-info { margin: 0; padding: 9px 12px; color: #58708a; border-radius: 6px; background: var(--accent-soft); font-size: 12px; }
.bom-note-field { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: start; }
.bom-note-field > span { padding-top: 6px; color: #8b9297; font-size: 12px; }
.bom-note-field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; font-size: 13px; resize: vertical; }
.bom-note-field p { margin: 6px 0 0; color: #4d545a; font-size: 13px; }
.bom-section { margin-top: 12px; }
.bom-kind-block + .bom-kind-block { margin-top: 18px; }
.bom-kind-heading { display: flex; align-items: center; justify-content: space-between; }
.bom-kind-heading h3 { display: flex; align-items: center; gap: 6px; margin: 0; color: #3b4247; font-size: 15px; font-weight: 500; }
.bom-kind-heading h3 em { padding: 0 6px; color: #8b9297; border-radius: 8px; background: #f2f3f4; font-size: 11px; font-style: normal; }
.bom-kind-heading .profile-add-link { margin: 0; }
.bom-table-wrap { margin-top: 8px; }
.bom-sheet-table { min-width: 760px; }
.bom-sheet-table th { color: #8b9297; font-size: 12px; font-weight: 500; vertical-align: bottom; }
.bom-sheet-table td { vertical-align: middle; font-size: 13px; }
.bom-sheet-table input, .bom-sheet-table select { width: 100%; height: 32px; padding: 0 8px; color: var(--text); border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fff; font-size: 13px; }
.bom-sheet-table input:focus, .bom-sheet-table select:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.bom-sheet-table .col-purpose { width: 170px; }
.bom-sheet-table .col-number { width: 96px; text-align: right; white-space: nowrap; }
.bom-sheet-table .col-number input { text-align: right; }
.bom-sheet-table .col-number small { display: block; color: #a3a9ad; font-size: 11px; }
.bom-sheet-table .col-seq { width: 36px; color: #a3a9ad; }
.bom-sheet-table .col-section { width: 96px; }
.bom-sheet-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.bom-sheet-table .col-actions .text-button { margin: 0 0 0 8px; background: transparent; }
.bom-sheet-table .col-material { min-width: 170px; }
.colorway-heads { display: flex; gap: 8px; margin-top: 4px; }
.colorway-heads span { flex: 1; color: #4d545a; font-weight: 500; }
.by-colorway-toggle { display: block; margin: 4px 0 0 !important; padding: 0; background: transparent; color: var(--accent) !important; font-size: 11px; }
.bom-empty-row { padding: 18px 8px !important; color: #a3a9ad; text-align: center; font-size: 12px; }
.material-chip { display: grid; width: 100%; gap: 1px; padding: 6px 9px; color: #4d545a; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfc; text-align: left; line-height: 1.35; }
button.material-chip:hover { border-color: #8fc3ee; background: var(--accent-soft); }
.material-chip span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.material-chip small { color: #8b9297; font-size: 11px; }
.material-chip.is-empty { place-items: center; min-height: 44px; border-style: dashed; color: var(--accent); background: #fff; }
.material-chip.is-readonly { border-color: transparent; background: transparent; padding-left: 0; }
.material-chip-empty { color: var(--accent); font-size: 12px; }
.bom-op-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.bom-op-footer .profile-add-link { margin: 0; }
.bom-op-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: #8b9297; font-size: 12px; }
.bom-op-totals strong { color: #3b4247; font-size: 13px; font-weight: 500; }
.bom-costing { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.bom-cost-inputs h4 { margin: 0 0 8px; color: #3b4247; font-size: 13px; font-weight: 500; }
.bom-cost-inputs h4 + * { margin-top: 0; }
.bom-cost-inputs h4:not(:first-child) { margin-top: 20px; }
.bom-cost-inputs h4 small { color: #a3a9ad; font-weight: 400; }
.other-cost-row { display: grid; grid-template-columns: 1fr 90px auto; gap: 6px; margin-bottom: 6px; }
.other-cost-row input { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; outline: 0; font-size: 13px; }
.other-cost-row .text-button { margin: 0; background: transparent; }
.other-cost-row.is-readonly { grid-template-columns: 1fr auto; font-size: 13px; }
.profit-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profit-editor input { width: 90px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; outline: 0; text-align: right; font-size: 13px; }
.profit-editor span { color: #8b9297; font-size: 12px; }
.profit-readonly { margin: 0; color: #4d545a; font-size: 13px; }
.bom-cost-table { min-width: 0; }
.bom-cost-table th, .bom-cost-table td { padding: 8px 10px; font-size: 13px; text-align: right; }
.bom-cost-table th:first-child { color: #8b9297; font-weight: 400; text-align: left; }
.bom-cost-table thead th { color: #4d545a; font-weight: 500; }
.bom-cost-table tr.is-subtotal td, .bom-cost-table tr.is-subtotal th { color: #3b4247; background: #f8f9fa; font-weight: 500; }
.bom-cost-table tr.is-total td, .bom-cost-table tr.is-total th { color: var(--accent-dark); background: var(--accent-soft); font-size: 15px; font-weight: 600; }
.bom-warnings { margin: 10px 0 0; padding: 10px 12px 10px 28px; color: var(--warning); border-radius: 6px; background: var(--warning-soft); font-size: 12px; }
.problem-list { margin: 8px 0 0; padding-left: 20px; color: #4d545a; font-size: 13px; line-height: 1.8; }
@media (max-width: 1000px) { .bom-costing { grid-template-columns: 1fr; } }

/* ---------- BOM算料：列表（紧凑表格）与编辑页（紧凑页头 + 吸顶出厂价条） ---------- */
.bom-list-table .bom-list-name { display: grid; gap: 2px; }
.bom-list-name > span:first-child { display: flex; align-items: center; gap: 8px; }
.bom-list-name small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.bom-list-mobile { display: none !important; }
.bom-list-table .col-status small { display: block; margin-top: 2px; font-size: 11.5px; }
.bom-list-table .col-content, .bom-list-table .col-updated { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) {
  .record-table.bom-list-table { min-width: 0; }
  .record-table.bom-list-table td, .record-table.bom-list-table th { white-space: normal; }
  .record-table.bom-list-table .col-status, .record-table.bom-list-table .col-content, .record-table.bom-list-table .col-updated { display: none; }
  .record-table.bom-list-table .bom-list-mobile { display: flex !important; align-items: center; flex-wrap: wrap; gap: 6px; }
  .record-table.bom-list-table .record-image-cell { width: 52px; padding-right: 4px; }
  .record-table.bom-list-table .record-image-preview, .record-table.bom-list-table .record-image-placeholder { width: 40px; height: 40px; }
  .bom-list-name > span:first-child { flex-wrap: wrap; gap: 4px 8px; }
  .bom-list-table .col-price { white-space: nowrap; }
}
.bom-header { margin-bottom: 10px; }
.bom-header .profile-title-line h1 { margin: 0; font-size: 26px; line-height: 1.25; }
.bom-header .back-link { margin-bottom: 4px; }
.bom-meta { gap: 8px; padding: 12px 16px; }
.bom-meta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.bom-product { gap: 12px; }
.bom-product img, .bom-product-placeholder { width: 40px; height: 46px; border-radius: 6px; font-size: 16px; }
.bom-product > div { gap: 3px; }
.bom-product strong .text-button { margin: 0 0 0 8px; font-weight: 400; }
.bom-note-field { grid-template-columns: 62px 1fr; align-items: center; }
.bom-note-field > span { padding-top: 0; }
.bom-note-field input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; font-size: 13px; }
.bom-note-field input:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.bom-note-field p { margin: 0; }
.bom-info { padding: 6px 10px; }
.bom-sticky { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin: 10px 0 0; padding: 7px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .96); box-shadow: 0 4px 14px rgba(22, 32, 40, .07); backdrop-filter: blur(6px); }
.bom-jump { display: flex; gap: 2px; }
.bom-jump button { height: 28px; padding: 0 11px; color: #687076; border-radius: 6px; background: transparent; font-size: 13px; cursor: pointer; }
.bom-jump button:hover { color: var(--accent-dark); background: var(--accent-soft); }
.bom-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.bom-sum-label { color: var(--muted); font-size: 12px; }
.bom-sum-price { display: inline-flex; align-items: baseline; gap: 6px; height: 28px; padding: 0 10px; align-items: center; border-radius: 6px; background: var(--accent-soft); cursor: pointer; }
.bom-sum-price span { color: #5c7a93; font-size: 12px; }
.bom-sum-price strong { color: var(--accent-dark); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bom-sum-warn { height: 28px; padding: 0 10px; color: var(--warning); border-radius: 6px; background: var(--warning-soft); font-size: 12px; cursor: pointer; }
.bom-section { margin-top: 10px; padding: 14px 18px 16px; scroll-margin-top: 58px; }
.bom-section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-bottom: 4px; }
.bom-section-title h2 { margin: 0; color: #2f424f; font-size: 17px; font-weight: 600; }
.bom-section-title span { color: var(--muted); font-size: 12px; }
.page-content.bom-editor thead th { top: 48px; }
.bom-sheet-table td { padding-top: 7px; padding-bottom: 7px; }
.bom-sheet-table .col-actions { width: 44px; text-align: center; }
.bom-sheet-table .col-material { min-width: 150px; }
.material-chip { gap: 0; padding: 5px 9px; }
.material-chip .chip-name { color: #3b4247; font-size: 13px; }
.material-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-chip small .code-text { font-weight: 500; }
.material-chip.is-empty { min-height: 40px; }
.bom-sheet-table .archive-more-toggle { position: relative; }
.bom-sheet-table .archive-more-toggle.has-extra::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.bom-kind-block + .bom-kind-block { margin-top: 14px; }
@media (max-width: 720px) {
  .bom-sticky { padding: 6px 10px; }
  .bom-jump { display: none; }
  .bom-sum { width: 100%; justify-content: space-between; }
  .bom-section { padding: 12px; }
}

/* ---------- 打印：只打印 BOM 内容 ---------- */
@media print {
  html { min-width: 0; background: #fff; }
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toast-host, .back-link { display: none !important; }
  .main-content { width: 100% !important; margin: 0 !important; }
  .page-content { max-width: none; padding: 0; }
  .panel { border: 0; padding: 8px 0; break-inside: avoid; }
  .bom-sheet-table, .bom-cost-table { min-width: 0; }
  .section-hint, .bom-section-title span { display: none; }
  .material-chip { border: 0; padding: 0; }
}

/* ---------- 自定义属性 ---------- */
.pairs-editor { display: grid; gap: 6px; }
.pair-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 6px; align-items: center; }
.pair-row input { width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fff; font-size: 13px; }
.pair-row input:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.pair-row .text-button { margin: 0; background: transparent; }
.pairs-add { justify-self: start; margin-top: 6px !important; }
.form-field .pairs-add { width: fit-content; }
.custom-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.custom-chips span { padding: 1px 6px; color: #687076; border-radius: 4px; background: #f2f3f4; font-size: 11px; white-space: nowrap; }
.custom-chips em { margin-right: 4px; color: #a3a9ad; font-style: normal; }
.page-header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- BOM：行详情、工序单位 ---------- */
.line-more-toggle { display: block; margin: 2px 0 0 !important; padding: 0; background: transparent; color: #8b9297 !important; font-size: 11px; }
.line-more-toggle:hover { color: var(--accent-dark) !important; }
.line-detail-row td { padding-top: 4px !important; background: #fafbfc; }
.line-detail-row.is-readonly td { padding: 2px 8px 10px !important; background: transparent; border-top: 0; }
.line-detail-grid { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); gap: 16px; padding: 6px 0; }
.line-detail-grid > label, .line-detail-grid > div { display: grid; gap: 6px; align-content: start; }
.line-detail-grid span { color: #8b9297; font-size: 12px; }
.line-note { margin-right: 10px; color: #687076; font-size: 12px; }
.bom-sheet-table .col-unit { width: 84px; }
.bom-sheet-table .col-section { width: 110px; }

/* ---------- 面料仓：布局、目录树 ---------- */
.modal-card.modal-card-xl { width: min(1100px, 100%); }
.fabric-layout { display: flex; align-items: flex-start; gap: 18px; }
.fabric-tree-panel { position: sticky; top: 20px; width: 280px; flex: 0 0 280px; max-height: calc(100vh - 90px); padding: 14px; overflow: auto; }
.fabric-tree-search { width: 100%; height: 34px; margin-bottom: 10px; }
.fabric-tree { display: grid; gap: 2px; font-size: 12.5px; }
.fabric-tree-toggle { display: flex; width: 100%; align-items: center; gap: 6px; padding: 6px 4px; color: #4a5258; background: transparent; border-radius: 5px; text-align: left; }
.fabric-tree-toggle:hover { background: #f2f3f4; }
.fabric-tree-toggle strong { flex: 1; font-weight: 500; }
.fabric-tree-toggle span { flex: 1; }
.fabric-tree-toggle em { color: #9aa0a5; font-size: 11px; font-style: normal; }
.fabric-tree-toggle .chevron { width: 12px; height: 12px; flex: none; transition: transform .15s; color: #9aa0a5; }
.fabric-tree-toggle .chevron.is-open { transform: rotate(180deg); }
.fabric-tree-fabrics, .fabric-tree-colors { display: grid; gap: 1px; padding-left: 14px; }
.fabric-tree-colors.is-hidden, .fabric-tree-fabrics.is-hidden { display: none; }
.fabric-tree-color { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; color: #687076; border-radius: 5px; text-decoration: none; font-size: 12px; }
.fabric-tree-color:hover { background: #f2f3f4; color: #3b4247; }
.fabric-tree-color.is-active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.fabric-tree-color em { color: #9aa0a5; font-style: normal; }
.fabric-tree-rollmatches { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fabric-tree-rollmatches-title { margin: 0 0 6px; color: #9aa0a5; font-size: 11px; }
.fabric-tree-rollmatch { display: grid; gap: 1px; padding: 6px 8px; border-radius: 5px; text-decoration: none; color: #4a5258; }
.fabric-tree-rollmatch:hover { background: #f2f3f4; }
.fabric-tree-rollmatch span { color: #8b9297; font-size: 11px; }
.fabric-tree-rollmatch em { color: #9aa0a5; font-size: 10px; font-style: normal; }
.fabric-main { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.fabric-main-header { min-height: auto; flex-wrap: wrap; gap: 12px 20px; }
.fabric-header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.fabric-metric-grid { margin: 0; }

/* ---------- 面料仓：规格卡片、换算器 ---------- */
.fabric-spec-panel { display: grid; gap: 16px; }
.fabric-spec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.fabric-spec-grid > div { display: grid; gap: 4px; }
.fabric-spec-grid span { color: #9aa0a5; font-size: 11px; }
.fabric-spec-grid strong { color: #3b4247; font-size: 14px; font-weight: 500; }
.fabric-converter { padding-top: 14px; border-top: 1px solid var(--line); }
.fabric-converter-title { margin: 0 0 8px; color: #8b9297; font-size: 12px; }
.fabric-converter-row { display: flex; flex-wrap: wrap; gap: 14px; }
.fabric-converter-row label { display: flex; align-items: center; gap: 6px; color: #687076; font-size: 12px; }
.fabric-converter-row input { width: 110px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fbfcfc; font-size: 13px; }
.fabric-tabs { margin: 0; }

/* ---------- 面料仓：一键入库 / 出库大弹窗 ---------- */
.entry-window { display: grid; gap: 16px; }
.entry-header-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.entry-common-panel, .entry-tools { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.entry-panel-title { margin: 0 0 10px; color: #687076; font-size: 12px; font-weight: 500; }
.entry-common-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.entry-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.entry-tool summary { cursor: pointer; color: #3b5f7b; font-size: 12px; font-weight: 500; }
.entry-tool-grid { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 10px; }
.entry-tool-grid .form-field { width: 110px; }
.entry-paste { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 10px; }
.entry-paste textarea { width: 360px; max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.entry-table-wrap { max-height: 46vh; overflow: auto; }
.entry-rows-table { min-width: 980px; }
.entry-rows-table .col-color { width: 140px; }
.entry-rows-table select { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 12px; }
.entry-row-dup td { background: #fdf0ee !important; }
.entry-row-error td { background: #fdf0ee !important; }
.entry-row-error-msg td { padding: 2px 8px 8px !important; color: #c65e48; font-size: 11px; border-top: 0; }
.entry-partial { display: inline-flex; gap: 4px; margin-left: 8px; }
.entry-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line); }
.entry-totals { display: flex; flex-wrap: wrap; gap: 16px; color: #4a5258; font-size: 13px; }
.entry-totals strong { margin-left: 4px; color: #3b4247; }
.entry-dyelot-warning { color: var(--warning); font-weight: 500; }
.is-selected td { background: #f5f9fc; }

/* ---------- 面料仓：单据详情 ---------- */
.fabric-doc-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.fabric-doc-meta > div { display: grid; gap: 4px; }
.fabric-doc-meta span { color: #9aa0a5; font-size: 11px; }
.fabric-doc-meta strong { font-size: 13px; font-weight: 500; }
.fabric-doc-void-note { grid-column: 1 / -1; color: var(--warning); font-size: 12px; }
.record-table tfoot td { padding-top: 12px; font-weight: 500; border-top: 1px solid var(--line); }
.is-void-section .record-table { opacity: .75; }

/* ---------- 面料仓：盘点 ---------- */
.stocktake-save-state { width: 60px; color: #9aa0a5; font-size: 11px; }
.diff-positive { color: #2f8f5b; font-weight: 500; }
.diff-negative { color: #c65e48; font-weight: 500; }
.file-label { position: relative; cursor: pointer; }
.file-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

@media (max-width: 1100px) {
  .fabric-layout { display: block; }
  .fabric-tree-panel { position: static; width: 100%; max-height: none; margin-bottom: 16px; }
}
/* 出库勾选框：不要被表格输入框的 100% 宽度撑大 */
.entry-window input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.entry-window .checkbox-line { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.entry-window .entry-partial input { width: 84px; height: 30px; }
.entry-window .entry-partial select { width: 64px; height: 30px; }

/* ---------- 物料选择：面料显示库存 ---------- */
.picker-list.has-stock .picker-item { grid-template-columns: 100px minmax(0, 1.4fr) minmax(0, 1fr) 110px 130px; }
.picker-stock { color: var(--accent-dark); font-size: 12px; text-align: right; white-space: nowrap; }
.picker-stock.is-empty { color: #a3a9ad; }

/* ---------- 面料仓：按卷 / 按批规格，和面料档案不同的标黄 ---------- */
.spec-cell { white-space: nowrap; }
.spec-diff { padding: 0 3px; color: #8a5a00; background: #fff3cd; border-radius: 3px; }
.entry-spec-update { margin-top: 10px; color: #8a5a00; font-size: 12.5px; }
.entry-spec-update.is-hidden { display: none; }
.fabric-tree-color.is-inactive span { color: #b4b9bd; }

/* ---------- 面料仓目录：总览入口、新建供应商 / 面料 ---------- */
.fabric-tree-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.fabric-tree-top .text-button { margin: 0; font-size: 12px; }
.fabric-tree-home { padding: 5px 8px; color: #4a5258; border-radius: 5px; text-decoration: none; font-weight: 500; }
.fabric-tree-home:hover { background: #f2f3f4; }
.fabric-tree-home.is-active { background: var(--accent-soft); color: var(--accent-dark); }
.fabric-tree-add { display: block; width: 100%; padding: 5px 8px; color: var(--accent-dark); background: transparent; border-radius: 5px; font-size: 12px; text-align: left; }
.fabric-tree-add:hover { background: var(--accent-soft); }

/* ---------- 一键入库 / 出库：窗口占满高度，只有卷表格滚动；上方资料可收起 ---------- */
.modal-card.modal-card-entry { display: flex; flex-direction: column; width: min(1360px, 96vw); height: calc(100vh - 48px); max-height: none; padding: 16px 22px; overflow: hidden; }
.modal-card-entry .entry-window { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; }
.modal-card-entry .modal-heading { flex: none; }
.modal-card-entry .entry-top { display: grid; flex: 0 1 auto; gap: 10px; min-height: 0; overflow-y: auto; }
.modal-card-entry .entry-table-wrap { flex: 1 1 0; min-height: 150px; max-height: none; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.modal-card-entry .entry-rows-table thead th { position: sticky; top: 0; z-index: 1; padding-top: 8px; padding-bottom: 8px; background: #fafbfc; }
.modal-card-entry .entry-rows-table td { padding: 3px 6px; }
.modal-card-entry .entry-rows-table input, .modal-card-entry .entry-rows-table select { height: 30px; }
.modal-card-entry .entry-footer { flex: none; }
.modal-card-entry .modal-actions { margin-top: 0; }
.entry-note { flex: 1; margin: 0; }
/* 紧凑的表头资料 */
.modal-card-entry .entry-header-grid { gap: 8px 12px; }
.modal-card-entry .form-field { gap: 3px; }
.modal-card-entry .form-field input, .modal-card-entry .form-field select { height: 32px; }
.modal-card-entry .entry-common-panel, .modal-card-entry .entry-tools { padding: 8px 12px; }
.modal-card-entry .entry-panel-title { margin-bottom: 6px; }
.modal-card-entry .entry-spec-update { margin-top: 6px; }
.entry-more summary { cursor: pointer; color: #3b5f7b; font-size: 12px; font-weight: 500; }
.entry-more-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
/* 收起 / 展开 */
.entry-heading-actions { display: flex; align-items: center; gap: 12px; }
.entry-collapse-toggle { margin: 0; font-size: 12px; }
.entry-summary { display: none; }
.entry-window.is-collapsed .entry-top { display: none; }
.entry-window.is-collapsed .entry-summary { display: block; flex: none; width: 100%; padding: 8px 12px; overflow: hidden; color: #4a5258; border: 1px dashed var(--line); border-radius: 6px; background: #fafbfc; font-size: 12.5px; text-align: left; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.entry-window.is-collapsed .entry-summary:hover { border-color: #8fc3ee; }
@media (max-width: 900px) {
  .modal-card-entry .entry-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-card-entry .entry-common-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 全站：弹窗按字段数量自动加宽加列，尽量一页显示完 ---------- */
.modal-card { position: relative; }
.modal-card.modal-card-cols-3 { width: min(940px, 96vw); }
.modal-card.modal-card-cols-4 { width: min(1220px, 96vw); }
.form-grid.form-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.form-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 多列时，备注和自定义属性各占一半、并排放 */
.form-grid-cols-4 .form-field-wide:has(textarea), .form-grid-cols-4 .form-field-wide:has(.pairs-editor), .form-grid-cols-4 .form-field-wide:has([data-pairs]) { grid-column: span 2; }
.modal-card .form-grid { gap: 10px 14px; }
.modal-card .form-field textarea { min-height: 62px; height: 62px; }
.modal-card .form-field .field-hint { font-size: 11px; line-height: 1.3; }
.modal-card .modal-note { margin-bottom: 12px; }
.modal-card .modal-actions { margin-top: 16px; }
@media (max-width: 900px) {
  .form-grid.form-grid-cols-3, .form-grid.form-grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-cols-4 .form-field-wide:has(textarea), .form-grid-cols-4 .form-field-wide:has([data-pairs]) { grid-column: 1 / -1; }
}

/* ---------- 全站：关闭弹窗前的确认（叠在弹窗上，不替换弹窗内容） ---------- */
.modal-inline-confirm { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .82); }
.modal-inline-confirm-box { padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgba(22, 32, 40, .14); }
.modal-inline-confirm-box p { margin: 0; color: #3b4247; font-size: 14px; }
.modal-inline-confirm-box .modal-actions { margin-top: 14px; }

/* ---------- 全站：按钮（链接做的按钮也一样高、没有下划线）、「更多 ▾」菜单 ---------- */
a.secondary-button, a.primary-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.page-header .secondary-button, .page-header .primary-button { box-sizing: border-box; height: 36px; min-height: 36px; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.menu-wrap { position: relative; display: inline-flex; }
.menu-pop { position: absolute; top: calc(100% + 4px); right: 0; z-index: 15; display: grid; min-width: 150px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgba(22, 32, 40, .14); }
.menu-pop.is-hidden { display: none; }
.menu-item { display: block; padding: 8px 12px; color: #4a5258; border-radius: 5px; background: transparent; font-size: 12.5px; text-align: left; text-decoration: none; white-space: nowrap; }
.menu-item:hover { background: #f2f3f4; }
.menu-item.danger-text { color: #c65e48; }

/* ---------- 辅料仓 ---------- */
.trim-thumb { display: inline-block; flex: none; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; background: #f5f6f7; vertical-align: middle; }
.trim-thumb-small { width: 36px; height: 36px; }
.trim-thumb.is-empty { background: repeating-linear-gradient(45deg, #f5f6f7, #f5f6f7 4px, #eef0f1 4px, #eef0f1 8px); }
.trim-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #9ccc9e; vertical-align: middle; }
.trim-dot.is-low { background: var(--warning); }
.trim-dot.is-empty { background: #c9ced2; }
.trim-tree-row { display: flex; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 5px; font-size: 12.5px; }
.trim-tree-row:hover { background: #f2f3f4; }
.trim-tree-row.is-active { background: var(--accent-soft); }
.trim-tree-row a { flex: 1; min-width: 0; overflow: hidden; padding: 3px 2px; color: #4a5258; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.trim-tree-row.is-active a { color: var(--accent-dark); }
.trim-tree-row strong { font-weight: 500; }
.trim-tree-row em { color: #9aa0a5; font-size: 11px; font-style: normal; }
.trim-tree-toggle { display: grid; width: 20px; height: 20px; place-items: center; padding: 0; border-radius: 4px; background: transparent; }
.trim-tree-toggle .chevron { width: 12px; height: 12px; color: #9aa0a5; transition: transform .15s; }
.trim-tree-toggle .chevron.is-open { transform: rotate(180deg); }
.trim-tree-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trim-kind-tag { display: inline-flex; padding: 2px 6px; color: #3b5f7b; border-radius: 4px; background: #eef4f9; font-size: 11px; }
.trim-kind-tag.is-packaging { color: #7a5b2e; background: #faf3e6; }
.trim-code { display: block; color: #9aa0a5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.trim-list-table td small { display: block; color: #9aa0a5; font-size: 11px; }
.trim-category-link { color: inherit; text-decoration: none; }
.trim-category-link:hover { color: var(--accent-dark); }
.trim-overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 18px; align-items: start; }
.trim-unit-list { display: grid; gap: 8px; }
.trim-unit-list div { display: flex; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; }
.trim-unit-list span { color: #687076; }
.trim-unit-list strong { color: #3b4247; font-weight: 600; }
.trim-item-panel { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.trim-image-zone { position: relative; display: grid; width: 240px; height: 240px; place-items: center; overflow: hidden; border: 1px dashed #c9d3da; border-radius: 10px; background: #fafbfc; cursor: pointer; outline: 0; }
.trim-image-zone img { width: 100%; height: 100%; object-fit: contain; }
.trim-image-zone span { padding: 0 20px; color: #9aa0a5; font-size: 12px; text-align: center; }
.trim-image-zone:focus, .trim-image-zone.is-dragging { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 144, 239, .12); }
.trim-image-zone.is-uploading { opacity: .5; pointer-events: none; }
.trim-image-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.trim-image-actions .text-button { margin: 0; padding: 4px 8px; border-radius: 5px; background: rgba(255, 255, 255, .92); font-size: 12px; box-shadow: 0 1px 3px rgba(20, 30, 40, .12); }
.trim-image-zone:not(.is-empty) { cursor: default; }
.trim-item-info { display: grid; gap: 16px; }
.trim-stock-big { display: flex; align-items: baseline; gap: 12px; }
.trim-stock-big span { color: #9aa0a5; font-size: 12px; }
.trim-stock-big strong { color: #3b4247; font-size: 30px; font-weight: 600; }
.trim-stock-big small { margin-left: 4px; color: #687076; font-size: 14px; font-weight: 400; }
.trim-entry-name small { display: block; color: #9aa0a5; font-size: 11px; }
.trim-add-bar { flex-wrap: nowrap; }
.trim-add-input { flex: 0 0 380px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12.5px; }
.trim-add-input:focus { border-color: #8fc3ee; outline: 0; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.trim-entry-table td:first-child { width: 44px; }
.picker-thumb { width: 22px; height: 22px; margin-right: 6px; object-fit: cover; border-radius: 3px; vertical-align: middle; }
.warehouse-tabs { width: fit-content; margin-bottom: 14px; }
@media (max-width: 1100px) {
  .trim-overview-grid, .trim-item-panel { grid-template-columns: 1fr; }
  .trim-add-bar { flex-wrap: wrap; }
  .trim-add-input { flex: 1 1 100%; }
}
/* 仓库页标题区：说明文字自己换行，按钮固定在右边 */
.fabric-main-header > div:first-child { flex: 1 1 360px; min-width: 0; }
.fabric-main-header .fabric-header-actions { flex: 0 1 auto; margin-left: auto; }

/* ---------- 全站：表单字段顶部对齐（带提示文字的字段变高时，不把标签和输入框往下挤） ---------- */
.form-field { align-content: start; }

/* ---------- 全站：可搜索下拉框（选项多时用，例如供应商） ---------- */
.combo { position: relative; }
.combo .combo-input { width: 100%; height: 36px; padding: 0 28px 0 10px; color: var(--text); border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fbfcfc; font-size: 12.5px; }
.combo .combo-input:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.combo-arrow { position: absolute; top: 50%; right: 10px; color: #9aa0a5; font-size: 11px; transform: translateY(-50%); pointer-events: none; }
.combo-pop { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 30; max-height: 280px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgba(22, 32, 40, .14); }
.combo-pop.is-hidden { display: none; }
.combo-option { display: block; width: 100%; padding: 7px 10px; overflow: hidden; color: #3b4247; border-radius: 5px; background: transparent; font-size: 12.5px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.combo-option.is-empty { color: #9aa0a5; }
.combo-option.is-selected { color: var(--accent-dark); font-weight: 500; }
.combo-option.is-active, .combo-option:hover { background: var(--accent-soft); }
.combo-more { padding: 7px 10px; color: #9aa0a5; font-size: 11.5px; }
.modal-card-entry .combo .combo-input { height: 32px; }
.form-field input.is-invalid { border-color: #d0634c; box-shadow: 0 0 0 3px rgba(208, 99, 76, .12); }

/* ---------- 生产订单 ---------- */
.order-toolbar { flex-wrap: wrap; justify-content: flex-start; }
.order-filter-customer { width: 200px; }
.order-filter-customer .combo-input { height: 35px; }
.order-status-tabs { margin-left: auto; }
.order-status-tabs em { margin-left: 5px; color: #a3a9ad; font-size: 11px; font-style: normal; }
.order-table .col-number { text-align: right; white-space: nowrap; }
.order-thumb { width: 44px; height: 52px; font-size: 16px; }
.urgent-tag { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 6px; color: #fff; border-radius: 4px; background: #d0634c; font-family: var(--font); font-size: 11px; font-weight: 600; vertical-align: middle; }
.order-due { display: inline-grid; gap: 1px; }
.order-due small { font-size: 11px; }
.fabric-spec-grid span.order-due { color: inherit; font-size: inherit; }
.order-due.is-overdue, .fabric-spec-grid span.order-due.is-overdue { color: #c65e48; font-weight: 600; }
.order-due.is-soon, .fabric-spec-grid span.order-due.is-soon { color: var(--warning); font-weight: 600; }
.order-shortage { display: inline-flex; padding: 2px 7px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.order-shortage.is-short { color: #c65e48; background: #fdf0ed; }
.order-shortage.is-ready { color: var(--success); background: var(--success-soft); }

.order-info { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: start; }
.order-info-image { display: grid; width: 180px; height: 200px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.order-info-image img { width: 100%; height: 100%; object-fit: contain; }
.order-info-image .order-thumb { width: 100%; height: 100%; border: 0; font-size: 42px; }
.order-info-grid.is-editable { align-items: start; }
.order-info-grid label { display: grid; gap: 4px; align-content: start; }
.order-info-grid label > span { color: #9aa0a5; font-size: 11px; }
.order-info-grid input { width: 100%; height: 34px; padding: 0 10px; color: var(--text); border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fbfcfc; font-size: 13px; }
.order-info-grid input:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.order-info-grid .combo-input { height: 34px; }
.order-info-grid a { color: var(--accent); }
.order-note-field { grid-column: span 2; }
.order-bom-hint { margin-top: 10px; padding: 8px 12px; color: #8a6a1f; border-radius: 6px; background: var(--warning-soft); font-size: 12.5px; }
.order-bom-hint .text-button { margin: 0 0 0 6px; background: transparent; }
.order-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.order-summary > div { display: grid; gap: 4px; }
.order-summary span { color: #9aa0a5; font-size: 11px; }
.order-summary strong { color: #343a40; font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.order-summary small { margin-left: 4px; color: #868d92; font-size: 12px; font-weight: 400; }

.order-tabs-panel { padding: 14px 18px 18px; }
.order-tabs { width: fit-content; margin-bottom: 12px; }
.order-tabs button { display: inline-flex; min-height: 38px; align-items: center; padding: 0 17px; color: #81888d; border-radius: 5px; background: transparent; font-size: 13px; }
.order-tabs button.is-active { color: #3b5f7b; background: #fff; box-shadow: 0 1px 2px rgba(24, 32, 38, .06); font-weight: 500; }
.order-qty-hint { margin: 0 0 10px; color: #9aa0a5; font-size: 12px; }

.order-matrix { width: auto; min-width: 0; border-collapse: collapse; }
.order-matrix th, .order-matrix td { padding: 6px 5px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: right; white-space: nowrap; }
.order-matrix thead th { color: #8b9297; font-size: 12px; font-weight: 500; }
.order-matrix tbody td, .order-matrix tbody td:nth-child(n) { color: #3b4247; font-weight: 400; }
.order-matrix tbody td.col-total { font-weight: 600; }
.order-matrix .col-colorway { min-width: 150px; text-align: left; font-weight: 500; }
.order-matrix .col-qty { width: 60px; }
.order-matrix .col-qty input { width: 50px; padding: 0 4px; text-align: center; }
.order-matrix .col-price input { width: 80px; }
.order-matrix input { height: 32px; padding: 0 8px; color: var(--text); border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fff; font-size: 13px; text-align: right; }
.order-matrix input:focus { border-color: #8fc3ee; box-shadow: 0 0 0 3px rgba(36, 144, 239, .1); }
.order-matrix input::placeholder { color: #b5bbbf; }
.order-matrix .col-total { min-width: 70px; font-weight: 600; }
.order-matrix .col-amount { min-width: 96px; }
.order-matrix tfoot th, .order-matrix tfoot td { color: var(--accent-dark); background: var(--accent-soft); font-weight: 600; }
.order-matrix tr.is-missing { opacity: .6; }
.order-colorway, .order-material { display: flex; align-items: center; gap: 8px; }
.order-colorway img, .order-material img { width: 30px; height: 30px; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; }
.order-swatch { display: inline-block; width: 30px; height: 30px; flex: none; border: 1px dashed #c9d3da; border-radius: 5px; background: #fafbfc; }
.order-colorway small, .order-material small { display: block; font-size: 11px; font-weight: 400; }
.order-material > div { display: grid; gap: 2px; }

.order-material-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.order-material-summary { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.order-material-actions { display: flex; align-items: center; gap: 10px; }
.order-material-table { min-width: 0; table-layout: fixed; }
.order-material-table th, .order-material-table td { padding-left: 6px; padding-right: 6px; }
.order-material-table th:nth-child(1) { width: 19%; }
.order-material-table th:nth-child(2) { width: 17%; }
.order-material-table th.col-number { width: 7.1%; white-space: normal; }
.order-material-table td:nth-child(1), .order-material-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
.order-material-table td, .order-material-table th { vertical-align: top; }
.order-material-table td:first-child { color: inherit; font-family: var(--font); font-size: 13px; }
.order-material-table .col-number { text-align: right; white-space: nowrap; }
.order-material-table .col-number small { display: block; }
.order-material-table .col-number small.unit { display: inline; margin-left: 2px; color: #9aa0a5; }
.order-material-table .col-uses div { font-size: 12.5px; }
.order-material-table .col-uses small { display: block; }
.order-material-table tr.is-short .col-shortage { color: #c65e48; font-weight: 600; }
.order-kind-row th { padding: 8px 10px !important; color: #687076; background: #f5f7f8; font-size: 12px; text-align: left; }
.order-cost-table td:nth-child(n), .order-material-table td:nth-child(n) { color: #3b4247; font-family: var(--font); font-size: 13px; font-weight: 400; }
.order-material-table tr.is-short td.col-shortage { color: #c65e48; font-weight: 600; }
.order-material-table td.col-number:nth-child(n) { font-size: 12px; }
.order-cost-table .col-number { text-align: right; white-space: nowrap; }
.order-cost-table tfoot th, .order-cost-table tfoot td { color: var(--accent-dark); background: var(--accent-soft); font-weight: 600; }
.order-history { margin: 0; padding: 0; list-style: none; }
.order-history li { display: grid; grid-template-columns: 150px 100px minmax(0, 1fr) auto; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.order-history time, .order-history em { color: #9aa0a5; font-style: normal; }

/* 打印生产单：只打印 .order-print，屏幕上不显示 */
.order-print-host { display: none; }
@media print {
  body.is-printing-order .order-editor > :not(.order-print-host) { display: none !important; }
  body.is-printing-order .order-print-host { display: block; }
  @page { size: A4 landscape; margin: 10mm; }
  @page order { size: A4 landscape; margin: 10mm; @bottom-center { content: "第 " counter(page) " 页 / 共 " counter(pages) " 页"; font-size: 9pt; } }
  body.is-printing-order .order-print tr { break-inside: avoid; }
  /* 打印时只要生产单：隐藏弹窗和提示条（覆盖层会被打印到每页上），外层框架不限高、不裁切 */
  body.is-printing-order #appModal, body.is-printing-order .toast-host { display: none !important; }
  body.is-printing-order .app-shell, body.is-printing-order .main-content, body.is-printing-order #view, body.is-printing-order .view-host, body.is-printing-order .page-content { display: block; width: auto; margin: 0; padding: 0; min-height: 0; height: auto; overflow: visible; }
  /* 表头每页重复，标题不落在页底 */
  body.is-printing-order .order-print thead { display: table-header-group; }
  body.is-printing-order .order-print h2 { break-after: avoid; }
  /* 分页打印（默认）：带页码；压缩到一张时不加 */
  body.is-printing-order-paged { page: order; }
}
/* 一张 A4 横版：紧凑排版，字号小一些，由脚本整体缩放保证只有一页 */
.order-print { color: #000; font-size: 11px; line-height: 1.35; }
.order-print header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 70px; gap: 12px; align-items: start; margin-bottom: 6px; }
.order-print h1 { margin: 0; font-size: 18px; }
.order-print h2 { margin: 8px 0 3px; font-size: 12px; }
.order-print header p { margin: 2px 0 0; }
.order-print dl { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr; gap: 2px 8px; margin: 0; }
.order-print dt { color: #555; }
.order-print dd { margin: 0; font-weight: 600; }
.order-print header img { width: 70px; height: 78px; object-fit: contain; border: 1px solid #ccc; }
.order-print table { width: 100%; min-width: 0; border-collapse: collapse; }
.order-print th:nth-child(n), .order-print td:nth-child(n) { padding: 2px 5px; color: #000; border: 1px solid #999; background: #fff; font-size: 11px; font-weight: 400; text-align: left; white-space: normal; }
.order-print thead th:nth-child(n), .order-print tfoot :nth-child(n) { font-weight: 600; }
.order-print .print-qty td:nth-child(n), .order-print .print-qty thead th:nth-child(n) { text-align: center; }
.order-print .print-qty th:first-child { text-align: left; }
.order-print small { color: #555; }
.order-print-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.order-print-ops ol { margin: 2px 0 0; padding-left: 16px; }
.order-print td.print-img { width: 50px; padding: 2px; text-align: center; }
.order-print td.print-img img { display: block; width: 44px; height: 44px; margin: 0 auto; object-fit: contain; }
.order-print .op-note { margin-top: 6px; min-height: 22px; border: 1px solid #999; padding: 3px 6px; }
.order-print footer { display: flex; gap: 80px; margin-top: 8px; }
@media (max-width: 1100px) {
  .order-info { grid-template-columns: 1fr; }
  .order-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 全站：图片可以点击放大 ---------- */
.page-content img, .modal-card img { cursor: zoom-in; }
.image-lightbox img, [data-own-preview] img { cursor: default; }
.image-lightbox { z-index: 2000; }
.image-lightbox-footer a.text-button { color: var(--accent); font-size: 13px; text-decoration: none; }

/* ---------- 辅料仓目录：辅料 / 包装辅料 两大组 ---------- */
.trim-tree-group + .trim-tree-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.trim-tree-group-row { display: flex; align-items: center; gap: 6px; padding: 4px 2px; }
.trim-tree-group-row .trim-kind-tag { font-size: 12px; font-weight: 600; }
.trim-tree-group-row em { margin-left: auto; color: #9aa0a5; font-size: 11px; font-style: normal; }
.trim-tree-group-body { padding-left: 6px; }
.trim-tree-group-empty { display: grid; gap: 4px; padding: 6px 8px; color: #9aa0a5; font-size: 12px; }
.trim-tree-group-empty .fabric-tree-add { justify-self: start; }

/* 放大预览：图片完整缩放在框里（原来 max-height:100% 在网格里不生效，高图会被截掉） */
.image-lightbox-stage { position: relative; overflow: hidden; --stage-pad: 26px; }
.image-lightbox-stage img { position: absolute; top: var(--stage-pad); left: var(--stage-pad); width: calc(100% - 2 * var(--stage-pad)); height: calc(100% - 2 * var(--stage-pad)); max-width: none; max-height: none; object-fit: contain; }
@media (max-width: 620px) { .image-lightbox-stage { --stage-pad: 12px; } }

/* 配色图框：没图时点击选图，支持拖拽、Ctrl+V 粘贴 */
.colorway-image-preview.is-empty { cursor: pointer; padding: 10px; line-height: 1.6; text-align: center; font-size: 12px; }
.colorway-image-preview.is-empty:hover { border-color: var(--accent); color: var(--accent); }
.colorway-upload-panel.is-dragover .colorway-image-preview { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 144, 239, .12); }

/* ---------- 产品款式图：一张大图 + 缩略图（图片再多高度也固定） ---------- */
.style-image-dropzone:has(.style-image-main) { display: block; min-height: 0; padding: 0; cursor: default; }
.style-image-dropzone:has(.style-image-main):hover { border-color: #cfd7dd; background: #f7f9fa; }
.style-image-dropzone.is-dragover { border-color: #76b7ee !important; background: var(--accent-soft) !important; }
.style-image-gallery:has(.style-image-main) { display: grid; height: auto; grid-template-columns: 1fr; gap: 8px; padding: 8px; }
.style-image-main { position: relative; display: grid; width: 100%; height: 360px; place-items: center; padding: 0; overflow: hidden; border: 0; border-radius: 6px; background: #fff; cursor: zoom-in; }
/* 图片铺满固定高度的框、完整显示（竖版图以前会撑出框外，下半截被裁掉） */
.style-image-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.style-image-count { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; color: #fff; border-radius: 4px; background: rgba(29, 45, 56, .62); font-size: 11px; }
.style-thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.style-thumb { position: relative; display: grid; aspect-ratio: 1; place-items: center; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 6px; background: #eef1f3; cursor: pointer; }
.style-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.style-thumb.is-selected { border-color: var(--accent); }
.style-thumb:hover:not(.is-selected) { border-color: #b9d6ee; }
.style-thumb .style-image-cover { top: 2px; left: 2px; padding: 0 4px; font-size: 9px; }
.style-thumb-more { color: #53748b; background: #e6edf2; font-size: 15px; font-weight: 600; line-height: 1.1; }
.style-thumb-more small { display: block; font-size: 10px; font-weight: 400; }
.style-thumb-add { color: #7d9aad; border: 1px dashed #b9cfdf; background: #fff; font-size: 22px; }
.style-thumb-add:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 620px) { .style-image-main { height: 260px; } .style-thumbs { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- 逐级选物料（供应商 → 面料 / 类别 → 物料） ---------- */
.mb-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 26px; margin-bottom: 6px; font-size: 13px; }
.mb-crumb { padding: 2px 6px; color: var(--accent); border-radius: 4px; background: transparent; font-size: 13px; }
.mb-crumb:hover { background: var(--accent-soft); }
.mb-crumb.is-current { color: #3b4247; font-weight: 600; }
.mb-crumb-sep { color: #b5bbbf; }
.mb-crumb-note { color: #9aa0a5; font-size: 12px; }
.mb-node { display: grid; grid-template-columns: minmax(0, 1fr) auto 90px; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: #3b4247; border-radius: 6px; background: transparent; text-align: left; }
.mb-node:hover { background: var(--accent-soft); }
.mb-node-name { overflow: hidden; font-size: 13.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.mb-node-name small { margin-left: 10px; color: #9aa0a5; font-size: 12px; font-weight: 400; }
.mb-node-count { color: #8b9297; font-size: 12px; white-space: nowrap; }
.mb-node-go { color: var(--accent); font-size: 12px; text-align: right; white-space: nowrap; }
.mb-supplier { margin-left: 8px; color: #9aa0a5; font-size: 11px; }
.picker-item.is-disabled { opacity: .5; cursor: not-allowed; }
.picker-item.is-disabled:hover { background: transparent; }
.material-browser .picker-list { min-height: 200px; }
.trim-add-panel { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfc; }
.trim-add-panel .picker-list { max-height: 34vh; min-height: 0; }
.trim-add-panel .picker-search { margin-top: 0; }
.st-picked { margin-bottom: 6px; color: #687076; font-size: 13px; }
.st-picked strong { color: var(--accent-dark); }
.st-browser .picker-list { max-height: 30vh; min-height: 0; }
.st-browser .picker-search { margin-top: 0; }

/* ---------- BOM 面辅料：每个物料格上方标适用配色 ---------- */
.chip-scope { display: inline-block; margin-bottom: 3px; padding: 0 6px; color: #3b5f7b; border-radius: 4px; background: #eef4f9; font-size: 11px; font-weight: 500; }
.chip-scope.is-common { color: #687076; background: #f0f2f3; }
.chip-warning { display: block; margin-top: 3px; font-size: 11px; }
.bom-merge-hint { margin: 0 0 8px; padding: 8px 12px; color: #8a6a1f; border-radius: 6px; background: var(--warning-soft); font-size: 12.5px; line-height: 1.6; }
.bom-merge-hint .text-button { margin: 0 0 0 6px; background: transparent; font-weight: 600; }

/* 款式结构 / 基本信息：内容长时自动换行，不再截成省略号；同一行的格子等高，分隔线对齐 */
.detail-definition-grid > div, .basic-info-grid > div { align-items: start; padding: 14px 0; }
.detail-definition-grid span, .basic-info-grid span { line-height: 1.55; }
.detail-definition-grid strong, .basic-info-grid strong { overflow: visible; white-space: normal; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.55; }

/* ---------- 新建订单：左边按分类选款式（带图片），右边填订单资料 ---------- */
.modal-card.order-create-card { width: min(1100px, 96vw); }
.order-create-card .form-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.order-create-card .order-style-field { grid-column: 1; grid-row: 1 / span 5; }
.order-create-card .form-field-wide:not(.order-style-field) { grid-column: 2 / -1; }
.style-picker { display: grid; gap: 8px; }
.style-chosen { display: flex; align-items: center; gap: 12px; min-height: 112px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: #fbfcfc; }
.style-chosen.has-value { border-style: solid; border-color: #cfe3f6; background: #f5faff; }
.style-chosen-empty { width: 100%; color: #9aa0a5; font-size: 13px; text-align: center; }
.style-chosen-info { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.style-chosen-info .style-chosen-label { color: #8c959b; font-size: 12px; }
.style-chosen-info strong { font-size: 16px; }
.style-chosen-info small { color: #8c959b; font-size: 12px; }
.style-thumb { display: inline-grid; flex: none; place-items: center; width: 44px; height: 52px; overflow: hidden; color: #9aa0a5; border: 1px solid var(--line); border-radius: 6px; background: #f3f4f5; font-size: 16px; }
.style-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.style-thumb.is-large { width: 88px; height: 104px; font-size: 30px; }
.style-thumb.is-large img { cursor: zoom-in; }
.style-thumb.is-mini { width: 26px; height: 32px; font-size: 12px; }
.style-list { display: grid; align-content: start; gap: 2px; min-height: 180px; max-height: 300px; overflow-y: auto; }
.style-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 60px; padding: 4px 10px; color: #4d545a; border-radius: 6px; background: transparent; text-align: left; font-size: 13px; }
.style-item:hover { background: var(--accent-soft); }
.style-item.is-current { background: #eef7ee; }
.style-item.is-disabled { opacity: .5; cursor: not-allowed; }
.style-item.is-disabled:hover { background: transparent; }
.style-info { display: grid; gap: 1px; min-width: 0; }
.style-info > span, .style-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-info small { color: #9aa0a5; font-size: 11px; }
.style-bom { color: #8c959b; font-size: 12px; white-space: nowrap; }
.style-problem { color: #c65e48; font-style: normal; }
.style-strip { display: flex; gap: 4px; margin-top: 4px; }

/* ---------- 订单列表：按 年 → 月 归档、手动调顺序 ---------- */
.order-move-heading, .order-move-cell { width: 62px; text-align: center; white-space: nowrap; }
.order-move { width: 22px; height: 22px; margin: 0 1px; color: #7d878d; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 10px; line-height: 1; }
.order-move:hover:not(:disabled) { color: var(--accent); border-color: #8fc3ee; background: var(--accent-soft); }
.order-move:disabled { color: #cfd4d7; cursor: default; }
.order-table tr.order-group { background: #f6f8f9; }
.order-table tr.order-group.is-year { background: #eef1f3; }
.order-table tr.order-group td { padding: 0; border-bottom: 1px solid var(--line-soft); }
.order-group-toggle { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 14px; color: #4d545a; background: transparent; text-align: left; font-size: 14px; }
.order-group.is-month .order-group-toggle { padding-left: 34px; font-size: 13px; }
.order-group-toggle:hover { background: var(--accent-soft); }
.order-group-arrow { width: 12px; color: #8c959b; }
.order-group-toggle small { color: #8c959b; font-size: 12px; }

/* 面料详情：左边图片框，右边规格和换算（和辅料详情一致） */
.fabric-spec-with-image { display: flex; align-items: flex-start; gap: 22px; }
.fabric-spec-with-image .trim-image-zone { flex: none; }
.fabric-spec-body { flex: 1; min-width: 0; }
@media (max-width: 900px) { .fabric-spec-with-image { flex-direction: column; } }

/* ---------- 采购：缺料、采购单和打印 ---------- */
.purchase-editor > .panel, .purchase-print-page > .panel { margin-bottom: 18px; }
.purchase-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.purchase-section-heading h2 { margin: 0; font-size: 16px; }
.purchase-info, .purchase-print-options { padding: 20px; }
.purchase-info .form-field { align-content: start; }
.purchase-info textarea, .purchase-print-options textarea { min-height: 62px; }
.purchase-save-note { margin: 8px 0 0; font-size: 13px; }
.purchase-line-table { min-width: 0; }
.purchase-line-table td { vertical-align: top; white-space: normal; }
.purchase-line-table .pl-mat { display: flex; align-items: flex-start; gap: 10px; min-width: 220px; }
.purchase-line-table .pl-mat img, .purchase-line-table .pl-mat .product-thumb { flex: none; }
.purchase-line-table .pl-qty { display: grid; grid-template-columns: minmax(70px, 1fr) 72px; gap: 6px; min-width: 150px; }
.purchase-line-table td:nth-child(3) { min-width: 170px; }
.purchase-line-table td:nth-child(5) { min-width: 130px; }
.purchase-line-table td:nth-child(7) { min-width: 120px; }
.purchase-line-table input, .purchase-line-table select { width: 100%; min-width: 64px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font: inherit; }
.purchase-line-table input:disabled, .purchase-line-table select:disabled { color: #8c959b; background: #f4f5f6; cursor: default; }
.purchase-line-table small { display: block; margin-top: 4px; font-size: 11px; }
.purchase-line-table small[hidden] { display: none; }
.purchase-price-cell { min-width: 185px; }
.purchase-price-mode { display: flex; margin-bottom: 7px; }
.purchase-price-mode button { font-size: 11px; padding: 5px 8px; }
.purchase-price-value { min-height: 32px; padding-top: 5px; }
.purchase-total { display: flex; justify-content: flex-end; padding: 18px 20px; font-weight: 600; border-top: 1px solid var(--line); }
.purchase-overdue { background: #fff4f2; }
.purchase-overdue input[type="date"] { color: #c65e48; border-color: #e1a89b; }
.purchase-orders { min-width: 65px; }
.purchase-orders summary { color: var(--accent); cursor: pointer; white-space: nowrap; }
.purchase-orders > div { margin-top: 5px; white-space: nowrap; font-size: 12px; }
.purchase-event { display: grid; grid-template-columns: 145px 65px 180px minmax(0,1fr) 85px; align-items: start; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.purchase-event p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.purchase-event time small { display: block; font-size: 11px; }
.purchase-receipt { display: grid; grid-template-columns: 200px 130px 1fr; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.order-shortage.is-awaiting { color: #8a6a1f; background: var(--warning-soft); }
.purchase-logo { min-height: 35px; }
.purchase-logo img { width: 60px; height: 40px; object-fit: contain; }
.modal-card.purchase-settings-card { width: min(1220px, 96vw); }
.purchase-settings-card .form-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.purchase-settings-card textarea { min-height: 78px; height: 78px; }
.purchase-settings-card .form-field-wide { grid-column: span 2; }
.modal-card.purchase-generate-card { width: min(1120px,96vw); max-height: 94vh; overflow: hidden; }
.purchase-generate-card form { display: flex; flex-direction: column; min-height: 0; }
.purchase-generate-card .form-grid { display: block; min-height: 0; }
.purchase-generate-table { max-height: 58vh; overflow: auto; }
.purchase-generate-table th { position: sticky; top: 0; z-index: 1; background: #f6f8f9; }
.purchase-generate-table td:first-child { min-width: 260px; }
.purchase-generate-table input[type="number"] { width: 120px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; }
.purchase-group-summary { padding-bottom: 14px; line-height: 1.7; }
.purchase-print-switches { display: flex; align-items: center; gap: 24px; margin-bottom: 18px; }
.purchase-print-sheet { width: 210mm; max-width: 100%; margin: 20px auto; padding: 14mm; box-sizing: border-box; background: white; box-shadow: 0 2px 16px #0001; color: #222; font-size: 11px; line-height: 1.5; }
.purchase-print-company { display: flex; align-items: center; gap: 14px; }
.purchase-print-company h2 { margin: 0 0 5px; font-size: 18px; }
.purchase-print-sheet p { margin: 5px 0; overflow-wrap: anywhere; }
.purchase-print-logo { width: 65px; max-height: 65px; object-fit: contain; }
.purchase-print-title { text-align: center; font-size: 25px; margin: 18px 0; letter-spacing: 5px; }
.purchase-print-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.purchase-print-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 10px 0; border-top: 1px solid #999; }
.purchase-print-sheet h3 { margin: 8px 0; font-size: 12px; }
.purchase-print-invoice { padding-bottom: 10px; }
.purchase-print-sheet table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.purchase-print-sheet td, .purchase-print-sheet th { padding: 6px 4px; border: 1px solid #999; vertical-align: top; overflow-wrap: anywhere; white-space: normal; }
.purchase-print-sheet thead th { position: static; box-shadow: none; }
.purchase-print-sheet th { background: #f3f3f3; }
.purchase-print-thumb { width: 36px; height: 42px; object-fit: contain; }
.purchase-print-text { white-space: pre-wrap; }
.purchase-print-totals { padding: 10px 0; }
.purchase-print-signatures { display: flex; justify-content: space-between; padding: 20px 8px; }
.purchase-print-signatures > div { width: 45%; }
.purchase-print-footer { text-align: center; color: #777; border-top: 1px solid #bbb; padding-top: 8px; font-size: 10px; }
@media (max-width: 900px) {
  .purchase-settings-card .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .purchase-event { grid-template-columns: 110px 70px 1fr; }
  .purchase-event p { grid-column: 1 / -1; }
  .purchase-print-parties { grid-template-columns: 1fr; }
}
@media print {
  @page purchase { size: A4 portrait; margin: 12mm; @bottom-center { content: "第 " counter(page) " 页 / 共 " counter(pages) " 页"; font-size: 9pt; } }
  body.is-printing-purchase { background: white; page: purchase; }
  body.is-printing-purchase .sidebar, body.is-printing-purchase .topbar, body.is-printing-purchase .no-print, body.is-printing-purchase #appModal, body.is-printing-purchase .toast-host { display: none !important; }
  body.is-printing-purchase .app-shell, body.is-printing-purchase .main-content, body.is-printing-purchase #view, body.is-printing-purchase .page-content { display: block; width: auto; margin: 0; padding: 0; min-height: 0; }
  body.is-printing-purchase .purchase-print-sheet { page: purchase; width: auto; max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .purchase-print-sheet thead { display: table-header-group; }
  .purchase-print-sheet tr, .purchase-print-company, .purchase-print-parties, .purchase-print-signatures, .purchase-print-totals { break-inside: avoid; page-break-inside: avoid; }
  .purchase-print-sheet h3 { break-after: avoid; }
  .purchase-print-sheet a { color: inherit; text-decoration: none; }
}

/* 页面里所有表格：往下滚时表头固定在窗口顶部。
   外层不能是滚动容器，所以宽屏下横向改用 clip（不产生滚动容器）；窄屏仍可左右滑，但表头不固定。
   弹窗里的表格自己有滚动区和固定表头，不在这里处理。 */
.page-content thead th { position: sticky; top: 0; z-index: 3; background: #f6f8f9; box-shadow: 0 1px 0 var(--line); }
@media (min-width: 1280px) {
  .page-content .table-wrap:not(.entry-table-wrap):not(.purchase-generate-table), .page-content .profile-mini-table, .page-content .materials-table { overflow-x: clip; overflow-y: visible; }
}

/* 采购单打印页：点「编辑明细」后，明细里的文字可以直接改（只影响这张单的打印） */
.purchase-print-edit[contenteditable="true"] { display: inline-block; box-sizing: border-box; max-width: 100%; vertical-align: top; min-width: 28px; min-height: 1em; padding: 0 3px; border: 1px dashed #8fc3ee; border-radius: 3px; background: #f7fbff; outline: 0; }
.purchase-print-edit[contenteditable="true"]:focus { border-style: solid; box-shadow: 0 0 0 2px rgba(36, 144, 239, .12); }

/* 手写签名：画布盖在签章区上方；不在手写状态时不挡鼠标，笔迹照样打印 */
.purchase-print-signatures { position: relative; }
.purchase-print-sign { position: absolute; inset: -24px 0 -8px 0; width: 100%; height: calc(100% + 32px); pointer-events: none; }
.purchase-print-sign.is-active { pointer-events: auto; cursor: crosshair; touch-action: none; outline: 1px dashed #8fc3ee; background: rgba(36, 144, 239, .04); }
@media print { .purchase-print-sign.is-active { outline: 0; background: none; } }

/* 盘点填数表：统计卡、分组、差异行 */
.st-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.st-stat { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; cursor: pointer; }
.st-stat span { color: #81888d; font-size: 12px; }
.st-stat b { font-size: 22px; font-weight: 600; color: #3b4247; }
.st-stat.is-green b { color: #2f8f5b; }
.st-stat.is-orange b { color: #c27b2a; }
.st-stat.is-gray b { color: #7b848a; }
.st-stat:hover { border-color: #bcd7ee; }
.st-stat.is-active { border-color: var(--accent); background: var(--accent-soft); }
.st-filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.st-filter-row .record-search { width: min(360px, 100%); }
.st-group-row td { padding: 8px 10px; background: #f4f6f7; cursor: pointer; }
.st-group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4b5358; }
.st-group-arrow { width: 12px; color: #8a9196; }
.st-group-count { margin-left: auto; color: #8a9196; font-size: 12px; }
.record-table tr.st-row-positive td { background: #f1faf4; }
.record-table tr.st-row-negative td { background: #fdf3f0; }
.st-hint { display: block; margin-top: 2px; color: #9aa0a5; font-size: 11px; text-align: right; }
@media (max-width: 900px) { .st-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 订单用料表：点物料名跳到仓库里的这个物料 */
.order-material-link { color: inherit; text-decoration: none; }
.order-material-link:hover strong { color: var(--accent); text-decoration: underline; }

/* 成品入库：款式选择区收紧，给数量矩阵保留空间。 */
.finished-entry-window .style-list { min-height: 100px; max-height: 140px; }
.finished-entry-window .style-chosen { min-height: 48px; }
.finished-entry-window .style-chosen .style-thumb.is-large { width: 48px; height: 48px; }
.finished-entry-window [data-picker] { font-size: 13px; }
.finished-entry-window [data-matrix] td { min-width: 125px; }

/* 成品出货、盘点数量输入。 */
.fg-number { width: 90px; max-width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 4px; }
@media print { .purchase-print-sheet thead th { position: static; box-shadow: none; } }

.finished-action-form .style-list { min-height: 90px; max-height: 140px; }
.finished-action-form .style-chosen .style-thumb.is-large { width: 48px; height: 48px; }

/* 纸单补录：表格横向展开，输入格紧凑；明细与操作保持在当前页。 */
.report-entry { padding: 16px; }
.report-grid td { padding: 7px; vertical-align: top; }
.report-grid .combo { min-width: 130px; }
.report-grid td:nth-child(2) .combo, .report-grid td:nth-child(3) .combo { min-width: 180px; }
.report-grid input[type="number"] { width: 78px; }
.report-grid input:not([type="hidden"]):not(.combo-input) { padding: 7px; border: 1px solid var(--line); border-radius: 4px; }
.report-grid input[data-key="note"], .report-grid input[data-key="reason"] { width: 130px; }
.report-entry [data-actions] { margin-left: auto; display: flex; align-items: center; gap: 8px; }
[data-detail]:not(:empty), [data-operation-records]:not(:empty) { padding: 16px; border-top: 1px solid var(--line); }
[data-save-state] { min-height: 24px; color: var(--muted); }

.report-entry [data-add][hidden] { display: none; }

/* 6.4 工人手机报工 */
html:has(body.is-worker) { min-width: 0; }
body.is-worker .sidebar, body.is-worker .topbar { display: none; }
body.is-worker .app-shell { display: block; min-width: 0; }
body.is-worker .main-content { margin: 0; width: 100%; min-width: 0; }
.worker-page { max-width: 640px; margin: auto; padding: 16px; overflow-wrap: anywhere; }
.worker-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.worker-heading h1 { font-size: 24px; margin: 0; }
.worker-nav { display: flex; gap: 8px; margin: 16px 0; }
.worker-nav a { flex: 1; text-align: center; min-height: 44px; padding: 12px; border-radius: 8px; background: #fff; text-decoration: none; }
.worker-nav .is-active, .worker-page .is-selected { background: #e9f3ff; color: #146bc1; border-color: #146bc1; }
.worker-card { display: grid; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; min-width: 0; }
.worker-card h2 { font-size: 18px; margin: 4px 0; }
.worker-card h3 { font-size: 16px; }
.worker-page p { margin: 6px 0; }
.worker-page label { display: grid; gap: 8px; }
.worker-page input, .worker-page select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; box-sizing: border-box; }
.worker-page button { font-size: 16px; min-height: 44px; white-space: normal; }
.worker-choices { display: grid; gap: 8px; }
.worker-order { display: flex; text-align: left; justify-content: start; gap: 12px; width: 100%; }
.worker-order img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; }
.worker-order small { display: block; }
.worker-counter { display: grid; grid-template-columns: 52px minmax(0,1fr) 52px; gap: 8px; }
.worker-counter button { font-size: 24px; }
.worker-counter input { text-align: center; font-size: 24px; }
.worker-line { padding: 12px 0; border-bottom: 1px solid var(--line); }
.worker-reference { padding: 12px; background: #e9f3ff; border-radius: 6px; }
@media (max-width:600px) {
  .login-main .form-field input, .login-submit { min-height:44px; font-size:16px; }
  .is-worker .modal-card { width: calc(100vw - 24px); min-width: 0; max-height: calc(100dvh - 24px); padding: 16px; overflow: auto; }
  .is-worker .modal-card button { min-height: 44px; }
  .is-worker .modal-actions { flex-wrap: wrap; }
  .is-worker .modal-card .form-grid { grid-template-columns: minmax(0,1fr); }
  .is-worker .modal-card .form-field-wide { grid-column: auto; }
  .is-worker .modal-card input { min-height: 44px; font-size: 16px; }
  .is-worker .report-review table, .is-worker .report-review tbody, .is-worker .report-review tr, .is-worker .report-review td { display: block; min-width: 0; width: auto; white-space: normal; }
  .is-worker .report-review thead { display: none; }
  .is-worker .report-review td { padding: 5px 8px; border: 0; }
  .is-worker .report-review td::before { content: attr(data-label) '：'; color: #65717d; }
  .is-worker .report-review tr { margin: 8px 0; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
  .is-worker .report-review .table-wrap { overflow: visible; }
}

/* 6.5 报工矩阵：窄屏配色独占一行，尺码自动换行。 */
.report-matrix {display:grid;gap:10px;min-width:0}
.matrix-color {border:1px solid var(--border,#ddd);border-radius:8px;padding:8px;min-width:0}
.matrix-color header {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.matrix-color img {width:36px;height:36px;object-fit:cover;cursor:zoom-in}
.matrix-sizes {display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:8px;margin-top:8px}
.matrix-cell {display:grid;gap:4px;min-width:0}
.matrix-cell input {width:100%;min-width:0;box-sizing:border-box}
.matrix-cell small {font-size:11px;overflow-wrap:anywhere}
.matrix-columns {display:flex;flex-wrap:wrap;gap:8px}
.matrix-dialog {width:min(1400px,96vw)!important;max-height:96dvh;display:flex;flex-direction:column;overflow:hidden!important}
.matrix-workspace {display:grid;grid-template-columns:minmax(180px,22%) minmax(0,1fr);gap:14px;min-height:0;overflow:hidden;flex:1}
.matrix-workspace>div {min-width:0;overflow:auto}
.matrix-workspace fieldset {margin-bottom:8px}
.matrix-workspace .checkbox-line {display:flex;margin:8px 0}
.archive-heading {background:#f4f6f8;font-weight:600}
.worker-page .matrix-sizes {grid-template-columns:repeat(auto-fit,minmax(80px,1fr))}
.worker-page .matrix-cell input {font-size:20px;padding:8px}
.worker-page .matrix-columns {display:none}
@media(max-width:600px){.matrix-workspace{grid-template-columns:1fr}.matrix-dialog{overflow:auto!important}}
.matrix-dialog {height:calc(100dvh - 48px)}
.matrix-dialog .matrix-sizes {grid-template-columns:repeat(var(--matrix-columns),minmax(72px,1fr))}
.matrix-empty {color:#9aa1a8;background:#f7f8fa;padding:5px}
.review-cards {display:grid;gap:8px;min-height:0;overflow:auto}
.review-cards details {border:1px solid var(--line);border-radius:8px;padding:10px}
.review-cards summary {cursor:pointer}
/* 页面挂载点只做透明容器，不改变页面自己的布局（每个页面渲染在独立挂载点里，离开时整块丢弃） */
.view-host {display:contents}

/* ---------- 辅料按尺码管理：颜色 × 尺码 矩阵 ---------- */
.pairs-name-only .pair-row { grid-template-columns: minmax(0, 1fr) auto; }
.pairs-name-only [data-pair-value] { display: none; }
.trim-sized-tag { margin-left: 6px; padding: 0 5px; border-radius: 3px; background: #e8f3fd; color: #1f6fb5; font-size: 11px; font-style: normal; }
.matrix-view-wrap { overflow-x: auto; }
.matrix-view-table { min-width: 560px; }
.matrix-view-table th, .matrix-view-table td { text-align: center; white-space: nowrap; }
.matrix-view-table .matrix-color-head, .matrix-view-table .matrix-color-cell { position: sticky; left: 0; z-index: 1; min-width: 96px; background: #fafbfc; text-align: left; font-weight: 600; }
.matrix-size-head strong { display: block; font-size: 14px; }
.matrix-size-head small { display: block; color: var(--muted, #7a8591); font-size: 12px; font-weight: 400; }
.matrix-view-table td.matrix-view-cell { color: #3b4247; font-weight: 500; cursor: pointer; }
.matrix-view-cell:hover { background: #f1f8fe; }
.matrix-view-cell.is-selected { outline: 2px solid #4aa3ea; outline-offset: -2px; background: #e8f3fd; }
.matrix-view-table td.matrix-view-cell.is-low { color: #b26a00; background: #fff8ec; }
.matrix-view-table td.matrix-view-cell.is-empty { color: #9aa4ad; }
.matrix-view-cell.is-inactive { opacity: .5; }
.matrix-foot th, .matrix-foot td { background: #fafbfc; font-weight: 600; }
.matrix-view-table tfoot .matrix-foot th { position: sticky; left: 0; }
.matrix-view-table .matrix-row-total { background: #fafbfc; }
/* 入库 / 出库的横版矩阵窗口 */
.matrix-sub { margin: 2px 0 0; color: #4a5258; font-size: 13px; }
.matrix-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.matrix-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.matrix-fill select, .matrix-fill input { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 13px; }
.matrix-fill input { width: 150px; }
.trim-matrix-table { min-width: 640px; }
.trim-matrix-table th, .trim-matrix-table td { text-align: center; }
.trim-matrix-table .matrix-color-head, .trim-matrix-table .matrix-color-cell { position: sticky; left: 0; z-index: 2; min-width: 110px; background: #fafbfc; text-align: left; white-space: nowrap; }
.trim-matrix-table .matrix-size-head { min-width: 96px; }
.trim-matrix-table .matrix-size-head strong { display: block; }
.trim-matrix-table .matrix-size-head small { display: block; color: #7a8591; font-size: 12px; font-weight: 400; }
.trim-matrix-table .matrix-price-row th { background: #fff; padding: 3px 6px; }
.trim-matrix-table .matrix-price-row input { width: 100%; text-align: center; }
.trim-matrix-table .tm-cell input { width: 100%; text-align: center; }
.trim-matrix-table .tm-cell input.is-over { border-color: #d9534f; background: #fff3f2; }
.trim-matrix-table .tm-cell.is-error input { border-color: #d9534f; background: #fff3f2; }
.trim-matrix-table .tm-cell.is-none { color: #b5bcc3; }
.matrix-stock { display: block; margin-top: 1px; color: #8a949d; font-size: 11px; line-height: 1.2; }
.trim-matrix-table tfoot th, .trim-matrix-table tfoot td { position: sticky; bottom: 0; background: #fafbfc; font-weight: 600; }
.trim-matrix-table .matrix-row-total { background: #fafbfc; font-weight: 600; }

/* BOM：按尺码对应的辅料，成衣尺码 → 辅料尺码 */
.bom-size-map { display: flex; flex-wrap: wrap; gap: 3px 4px; margin-top: 4px; }
.bom-size-chip { padding: 1px 6px; border: 1px solid #cfe3f5; border-radius: 10px; background: #f3f9fe; color: #35566f; font-size: 11px; white-space: nowrap; }
.bom-size-chip b { margin-right: 3px; color: #1f6fb5; }
.bom-size-chip.is-missing { border-color: #f1c6c3; background: #fff3f2; color: #b3342d; }
.pairs-compact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.pairs-compact.pairs-name-only { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trim-matrix-table tfoot th { text-align: left; }

body.is-finance .nav-group.is-admin-only[data-group="finance"] { display: block; }
