/* Order entry and component setup: scoped overrides after the shared theme. */
.order-name-label { display:flex; justify-content:space-between; align-items:center; gap:4px; }
.order-name-label label { min-width:0; }
#modal-generate-order-name { font-size:12px; color:#1659a7; padding:0 6px; min-height:24px; border-radius:5px; background:#edf5ff; white-space:nowrap; }
#modal-generate-order-name[hidden] { display:none; }
#modal-generate-order-name:disabled { opacity:.65; }
#modal-order-name-status { color:#61758d; font-size:11px; line-height:1.5; margin-top:4px; }
#modal-order-name-status:empty { display:none; }
.dark #modal-generate-order-name { color:#bfdbfe; background:#263e57; }
.dark #modal-order-name-status { color:#a8bad0; }
@media(max-width:760px) { #modal-generate-order-name { min-height:44px; } .order-name-label { min-height:44px; } #page-order-setup .order-identity-grid > div > label { min-height:44px; display:flex; align-items:center; margin-bottom:0; } }
#add-order-modal .viewport-modal-panel, #add-order-modal:has(#production-pdf-results .pdf-product) .viewport-modal-panel { max-width: 880px; }
#add-order-modal .viewport-modal-header { padding: 18px 24px; flex-direction: column; align-items: flex-start; }
#add-order-form-modal { padding: 18px 24px; }
#add-order-modal #add-order-form-modal > :not([hidden]) ~ :not([hidden]) { margin-top: 12px; }
#add-order-modal .viewport-modal-footer { padding: 12px 24px 18px; border-top: 1px solid #e2eaf4; }
.order-identity-grid, .order-details-grid { display: grid; gap: 12px; }
.order-identity-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.order-details-grid { grid-template-columns: minmax(0, 1fr) 90px repeat(2, minmax(0, 1.3fr)); }
#add-order-form-modal .order-identity-grid input, #add-order-form-modal .order-details-grid input, #add-order-form-modal .order-details-grid select { width: 100%; min-width: 0; height: 38px; padding: 6px 10px; border-width: 1px; font-size: 14px; }
#add-order-form-modal label { font-size: 13px; }
#add-order-modal[data-mode="view"] .order-identity-grid input,
#add-order-modal[data-mode="view"] .order-details-grid input,
#add-order-modal[data-mode="view"] .order-details-grid select { background: #f4f7fb; color: #253b56; border-color: #e2eaf4; opacity: 1; }
.dark #add-order-modal[data-mode="view"] .order-identity-grid input,
.dark #add-order-modal[data-mode="view"] .order-details-grid input,
.dark #add-order-modal[data-mode="view"] .order-details-grid select { background: #263449; color: #deebfc; border-color: #43536b; }
#production-order-import, #production-order-import.recognized { padding: 12px 14px; border-style: dashed; }
#production-order-import.recognized .pdf-import-heading p { display: block; }
#production-order-import .pdf-import-heading { flex-direction: row; align-items: center; gap: 12px; }
#production-order-import .pdf-import-description { min-width: 0; }
#production-order-import .pdf-import-description strong { font-size: 15px; }
#production-order-import .pdf-import-description small { display: block; margin-top: 3px; color: #72849a; font-size: 11px; }
#production-order-import .pdf-import-actions { margin: 0; gap: 6px; flex-shrink: 0; }
#production-order-import.drag-over { border-color: #1466e7; background: #e5efff; box-shadow: 0 0 0 2px #b9d3fa; }
#production-order-import button[hidden] { display: none; }
#production-pdf-status:empty { display: none; }
#production-pdf-status { margin-top: 6px; font-size: 12px; }
.pdf-warnings { margin: 8px 0; padding-top: 7px; padding-bottom: 7px; }
.pdf-list-heading { margin: 12px 0 8px; }
.pdf-product-list { gap: 8px; }
.pdf-product { grid-template-columns: 62px minmax(0, 1fr); padding: 10px; gap: 12px; align-items: center; }
.pdf-product-photo img { width: 62px; height: 62px; }
.pdf-product-photo small { font-size: 10px; margin-top: 3px; }
.pdf-product-fields { grid-template-columns: minmax(0, 2fr) minmax(0, 1.25fr) 100px auto; align-items: end; gap: 10px; }
.pdf-product-pair { display: contents; }
.pdf-product-fields > label, .pdf-product-pair > label { min-width: 0; }
.pdf-product-fields input { height: 36px; }
.pdf-product-fields .pdf-note-wrap { align-self: end; margin-bottom: 5px; }
.pdf-product-fields .pdf-note-icon { white-space: nowrap; }
.pdf-product-photo > span { font-size: 11px; color: #72849a; }
.component-setup-workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; max-width: 1800px; margin: 0 auto 18px; }
.component-order-context { display: grid; gap: 16px; min-width: 0; }
.pdf-library-empty { margin-top: 14px; padding: 20px 16px; border: 1px dashed #bbcee7; border-radius: 10px; background: #fff; }
.pdf-library-empty strong { font-size: 14px; }
.pdf-library-empty p { font-size: 13px; line-height: 1.7; color: #61758d; margin-top: 6px; }
.dark .pdf-library-empty { background: #243447; border-color: #435a78; }
.dark .pdf-library-empty p { color: #a8bad0; }
#production-component-library { width: 100%; min-width: 0; max-width: none; margin: 0; padding: 16px; border-radius: 12px; }
.pdf-library-heading { flex-direction: row; align-items: start; gap: 10px; flex-wrap: wrap; }
.pdf-library-heading > div:first-child { flex: 1 1 160px; min-width: 0; }
.pdf-library-heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.pdf-library-heading-actions button { white-space: nowrap; }
.pdf-library-heading strong { font-size: 16px; }
.pdf-library-heading p { overflow-wrap: anywhere; line-height: 1.5; }
.pdf-library-heading .pdf-button { font-size: 12px; padding: 6px 8px; }
.pdf-library-grid { grid-template-columns: minmax(0, 1fr); gap: 5px; margin-top: 10px; max-height: 480px; overflow-y: auto; padding: 2px; }
.pdf-library-card { grid-template-columns: 44px minmax(0, 1fr); padding: 8px; gap: 10px; align-items: center; border-width: 2px; }
.pdf-library-card img, .pdf-library-card .pdf-no-image { width: 44px; height: 44px; }
.pdf-library-card .pdf-no-image { display: grid; place-items: center; font-size: 10px; background: #f4f7fb; border-radius: 6px; }
.pdf-library-card-body { min-width: 0; display: flex; align-items: center; gap: 10px; }
.pdf-library-product-line { display: grid; flex: 1; min-width: 0; gap: 3px; }
.pdf-library-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; }
.pdf-library-product-line strong { min-width: 0; line-height: 1.5; }
.pdf-library-code { color: #64748b; font-size: 12px; max-width: 130px; overflow-wrap: anywhere; }
.pdf-library-quantity { color: #253b56; font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pdf-library-quantity > span { color: #64748b; font-size: 12px; font-weight: 400; }
.pdf-library-usage { font-size: 11px; color: #64748b; }
.pdf-library-card-actions > [data-product] { margin-left: 0; white-space: nowrap; }
.pdf-library-card .pdf-button { width: auto; font-size: 12px; padding: 5px 9px; }
.pdf-library-card .pdf-note-wrap { margin: 0; }
.pdf-library-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pdf-library-card.is-selected { border-color: #619bec; background: #f1f7ff; box-shadow: 0 0 0 1px #619bec; }
#add-component-form { min-width: 0; width: 100%; max-width: none; padding: 18px !important; margin: 0 !important; gap: 14px !important; border-radius: 12px !important; }
.component-editor-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.component-editor-heading h2 { color: #203854; font-size: 17px; font-weight: 700; }
.component-editor-heading p { color: #647b94; font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.component-editor-tag { font-size: 11px; color: #647b94; background: #f0f4f9; border-radius: 5px; padding: 3px 7px; white-space: nowrap; }
#add-component-form .component-create-layout { grid-template-columns: 104px minmax(0, 1fr); gap: 16px; align-items: start; }
#add-component-form .component-image-field { grid-column: 1; }
#add-component-form #upload-trigger { width: 104px; height: 128px; flex-basis: 104px; }
#add-component-form .component-primary-fields { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 10px; }
#add-component-form .component-primary-fields > div:last-child { grid-column: auto; }
#add-component-form .component-name-field { grid-column: 1 / -1; }
#add-component-form .component-primary-fields input, #add-component-form .component-primary-fields select, #add-component-form .component-copy-field select { font-size: 14px !important; min-width: 0; height: 42px; }
#add-component-form .component-primary-fields label { font-size: 12px !important; }
#add-component-form .component-copy-field { grid-column: 2; }
#add-component-form .component-import-remarks textarea { min-height: 58px; resize: vertical; }
.component-next-step { padding: 10px 12px; border-radius: 8px; background: #f4f7fb; color: #647b94; font-size: 12px; line-height: 1.7; }
.component-next-step p + p { margin-top: 2px; }
.dark .component-next-step { background: #263449; color: #a8bad0; }
.dark .component-next-step #component-pdf-process-note { color: #bfdbfe; }
#add-component-form .component-create-actions { grid-column: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid #e2eaf4; padding-top: 12px; }
#add-component-form .component-create-actions > button { height: 38px; min-height: 38px; padding: 0 22px !important; }
.component-outsourced-option { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
#add-component-form #component-is-outsourced { width: 16px; height: 16px; min-height: 16px; accent-color: #1466e7; }
#component-tabs-container:empty { display: none; }
.pdf-button:focus-visible, #upload-trigger:focus-visible, .pdf-note-icon:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.dark .component-editor-heading h2 { color: #deebfc; }
.dark .pdf-library-card.is-selected { background: #243c59; }
.dark .pdf-library-code, .dark .pdf-library-quantity > span, .dark .pdf-library-usage { color: #a8bad0; }
.dark .pdf-library-quantity { color: #deebfc; }
.dark .pdf-library-card .pdf-no-image { background: #1e293b; color: #a8bad0; }
/* The selected product and its editor read as one connected surface. */
.component-setup-workspace { position: relative; --product-context-line: #4389eb; --product-context-surface: #fff; }
.component-setup-workspace.has-selected-product #add-component-form,
.component-setup-workspace .pdf-library-card.is-selected { border: 2px solid var(--product-context-line) !important; background: var(--product-context-surface); box-shadow: none; }
.has-selected-product .component-editor-tag { color: #1d5daf; background: #eaf3ff; }
.has-selected-product #component-selection-status { color: #1d5daf; }
.component-product-connection { position: absolute; z-index: 2; pointer-events: none; background: var(--product-context-surface); border-block: 2px solid var(--product-context-line); }
.component-product-connection[hidden] { display: none; }
.has-product-connection .pdf-library-card.is-selected { border-right-color: transparent !important; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dark .component-setup-workspace { --product-context-line: #6ca9ff; --product-context-surface: #1f2937; }
.dark .has-selected-product .component-editor-tag { color: #bfdbfe; background: #263e57; }
.dark .has-selected-product #component-selection-status { color: #bfdbfe; }
@media (max-width: 1100px) {
    .component-setup-workspace { grid-template-columns: minmax(0, 1fr); }
    .pdf-library-grid { grid-template-columns: minmax(0, 1fr); max-height: 300px; }
}
@media (max-width: 700px) {
    .order-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-identity-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
    .pdf-product-fields { grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; }
    .pdf-product-fields > label { grid-column: 1 / -1; }
    .pdf-product-fields .pdf-note-wrap { grid-column: 1 / -1; margin: 0; }
    .pdf-list-heading { flex-direction: column; align-items: start; gap: 3px; }
    .pdf-library-grid { grid-template-columns: minmax(0, 1fr); }
    #add-component-form .component-copy-field { grid-column: 1 / -1; }
    #production-order-import .pdf-import-heading { flex-wrap: wrap; }
    #production-order-import .pdf-import-actions { margin-left: auto; }
}
@media (max-width: 440px) {
    #add-component-form .component-create-layout { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
    #add-component-form #upload-trigger { width: 72px; height: 88px; flex-basis: 72px; }
    #production-component-library { padding: 12px; }
    .pdf-library-card { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 8px; }
    .pdf-library-card img, .pdf-library-card .pdf-no-image { width: 40px; height: 40px; }
    .pdf-library-card-body { flex-wrap: wrap; gap: 6px; }
    .pdf-library-product-line { flex-basis: 100%; }
    .pdf-library-card-actions { gap: 6px; flex-wrap: wrap; }
    .pdf-library-card-actions > [data-product] { margin-left: 0; }
    .pdf-library-card .pdf-button, .pdf-library-card .production-note-button { min-height: 36px; }
    #add-component-form .component-primary-fields { grid-template-columns: minmax(0, 1fr); }
    #add-component-form .component-primary-fields > div:last-child { grid-column: auto; }
    .component-editor-tag { display: none; }
    #add-order-form-modal .order-identity-grid input, #add-order-form-modal .order-details-grid input, #add-order-form-modal .order-details-grid select { font-size: 16px; min-height: 44px; }
}
.production-settings-body { padding: 12px; }
.allowance-quantity-row { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.allowance-quantity-row > label { flex: 1 1 90px; min-width: 0; }
.allowance-quantity-row > label > span, .allowance-label { display: block; font-size: 12px; color: #64748b; margin-bottom: 6px; }
.allowance-quantity-row .target-quantity-input { width: 100%; height: 36px; padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 16px; font-weight: 700; }
.allowance-quantity-row .target-quantity-input[readonly] { background: #f1f5f9; color: #334155; }
.allowance-rate-group { flex: 1 1 205px; min-width: 0; }
.allowance-options { display: flex; gap: 5px; align-items: center; }
.allowance-preset { border: 1px solid #cbd5e1; border-radius: 7px; background: white; color: #475569; min-width: 36px; height: 36px; font-size: 13px; }
.allowance-preset[aria-pressed="true"] { color: #1d4ed8; background: #eff6ff; border-color: #3b82f6; font-weight: 700; }
.allowance-custom { display: flex; align-items: center; height: 36px; border: 1px solid #cbd5e1; border-radius: 7px; padding-right: 7px; background: white; color: #64748b; flex: 1; min-width: 68px; }
.allowance-custom input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 6px; font-size: 13px; outline-offset: -2px; }
.allowance-custom input::-webkit-inner-spin-button { appearance: none; }
.allowance-calculation-hint { font-size: 11px; line-height: 1.6; color: #64748b; margin: 7px 0 10px; }
.allowance-options button:disabled, .allowance-options input:disabled { opacity: .6; cursor: default; }
.dark .allowance-quantity-row .target-quantity-input[readonly] { background: #1e293b; }
.dark .allowance-preset, .dark .allowance-custom { background: #334155; color: #e2e8f0; border-color: #64748b; }
.dark .allowance-preset[aria-pressed="true"] { background: #1e3a8a; color: #bfdbfe; border-color: #60a5fa; }
.dark .allowance-quantity-row .target-quantity-input[readonly] { color: #e2e8f0; }
.dark .allowance-calculation-hint, .dark .allowance-label, .dark .allowance-quantity-row > label > span { color: #94a3b8; }
@media (max-width: 480px) { .allowance-quantity-row { gap: 8px; } .allowance-options { gap: 6px; } .allowance-preset, .allowance-custom { height: 40px; } }

#action-modal-text { white-space: pre-line; }
.allowance-preset { cursor: pointer; }
@media (max-width: 480px) { .component-create-actions { flex-wrap: wrap; gap: 8px; } .component-create-actions .component-outsourced-option { flex: 1 1 100%; } .component-create-actions button { flex: 1; } }

#add-component-form .component-create-actions > button[type="submit"] { margin-left: auto; }

#app-container > #page-tracking > header.tracking-edit-toolbar { position: sticky; top: 0; z-index: 35; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px; min-height: 72px !important; padding: 12px 24px !important; background: #eff6ff !important; border-bottom: 1px solid #cbdff8; }
#page-tracking .tracking-edit-toolbar #tracking-page-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
#page-tracking .tracking-edit-toolbar #back-to-orders-btn { white-space: nowrap; }
.tracking-edit-toolbar strong { display: block; font-size: 14px; color: #1e40af; }
.tracking-edit-toolbar p { margin: 3px 0 0; font-size: 12px; color: #64748b; }
#page-tracking #tracking-edit-toggle { min-height: 44px; padding: 8px 18px; flex-shrink: 0; border: 0; border-radius: 9px; background: #2563eb; color: white !important; font-size: 14px !important; font-weight: 600; white-space: nowrap; }
#page-tracking #tracking-edit-toggle:disabled { background: #64748b; }
#app-container > #page-tracking.tracking-settings-editing > header.tracking-edit-toolbar { background: #fff7ed !important; border-color: #fed7aa; }
.tracking-settings-editing .tracking-edit-toolbar strong { color: #9a3412; }
.tracking-settings-locked .component-card input:disabled, .tracking-settings-locked .component-card select:disabled { opacity: 1; color: #475569; background: #f1f5f9; -webkit-text-fill-color: #475569; }
.tracking-settings-locked .component-card button:disabled, .tracking-settings-locked #add-component-form button:disabled { opacity: .45; cursor: default; }
.dark #app-container > #page-tracking > header.tracking-edit-toolbar { background: #172b4b !important; border-color: #334155; }
.dark .tracking-edit-toolbar strong { color: #bfdbfe; }
.dark .tracking-edit-toolbar p { color: #94a3b8; }
.dark #app-container > #page-tracking.tracking-settings-editing > header.tracking-edit-toolbar { background: #422b1d !important; }
.dark .tracking-settings-editing .tracking-edit-toolbar strong { color: #fdba74; }
.dark .tracking-settings-locked .component-card input:disabled, .dark .tracking-settings-locked .component-card select:disabled { background: #1e293b; color: #cbd5e1; -webkit-text-fill-color: #cbd5e1; }
@media (max-width: 900px) {
    #app-container > #page-tracking > header.tracking-edit-toolbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 12px !important; }
    .tracking-edit-toolbar p { margin: 0; font-size: 11px; line-height: 1.5; }
    #page-tracking #tracking-edit-toggle { grid-column: 3; grid-row: 1; padding: 8px 12px; }
}

/* Clip horizontal overflow without creating an ancestor scroll container that breaks sticky controls. */
html.tracking-settings-active, body.tracking-settings-active { overflow-x: clip; overflow-y: visible; }

/* The editor sets the desktop row height; long libraries scroll inside it. */
@media (min-width: 1101px) {
    .component-order-context { align-self: stretch; contain: size; min-height: 0; grid-template-rows: minmax(0, 1fr); }
    #production-component-library { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
    #production-component-library .pdf-library-heading { flex-shrink: 0; }
    #production-component-library .pdf-library-grid { min-height: 0; max-height: none; overflow-y: auto; align-content: start; }
    #production-component-library .pdf-library-empty { overflow-y: auto; min-height: 0; }
}

/* Nodes fill the component column without the former timeline gutter. */
#components-container :is(.process-card, .accessory-node-card) { width: 100%; min-width: 0; margin: 0 !important; border-radius: 9px !important; }
#components-container :is(.process-card, .accessory-node-card)::before,
#components-container :is(.process-card, .accessory-node-card)::after { display: none !important; }
#components-container :is(.process-card, .accessory-node-card) .process-title { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
#components-container .production-settings-body { padding: 12px; }
#components-container .component-order-quantity-copy { flex-shrink: 0; white-space: nowrap; }
#components-container .component-order-quantity-control { min-width: 0; flex: 1; }
#components-container .allowance-quantity-row { gap: 10px; }
#components-container .allowance-quantity-row > label { flex: 1 1 90px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row .target-quantity-input { height: 36px !important; font-size: 18px !important; color: #1e40af; background: #eff6ff; border-color: #cbdcf2; }
#components-container .allowance-rate-group { --node-rate-font-size: 13px; flex: 0 0 110px; }
@media (max-width: 767px) {
    #components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row .target-quantity-input { font-size: 16px !important; }
    #components-container .allowance-rate-group { --node-rate-font-size: 15px; }
}
.allowance-calculation-details { margin-top: 10px; color: #64748b; font-size: 11px; }
.allowance-calculation-details summary { cursor: pointer; width: fit-content; padding: 3px 0; }
.allowance-calculation-details summary:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.allowance-calculation-details .allowance-calculation-hint { margin: 5px 0 0; }
.dark #components-container .allowance-quantity-row .target-quantity-input { color: #bfdbfe; background: #1e293b; border-color: #435a78; }
.dark .allowance-calculation-details { color: #a8bad0; }

/* Compact columns keep custom rates readable without stretching the input. */
@media (min-width: 768px) {
    #components-container .component-card { width: 360px; max-width: 360px; }
    #components-container .component-card > header > .flex:first-child > .flex:last-child { padding: 2px; }
    #components-container .component-card > header > .flex:first-child > .flex:last-child button { padding: 6px; }
}
#components-container .component-card > header > .flex:first-child > .flex:first-child { min-width: 0; flex: 1; }
#components-container .component-title { min-width: 0; }
#components-container .component-image-frame { position: relative; display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; overflow: hidden; border: 1px solid #d7e2ee; border-radius: 6px; background: #f1f5f9; }
#components-container .component-image-placeholder { font-size: 9px; color: #7b8da5; white-space: nowrap; }
#components-container .component-image-frame .component-header-img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; margin: 0 !important; object-fit: cover; cursor: pointer; }
#components-container .allowance-options { gap: 4px; }
#components-container .allowance-preset { flex: 0 0 32px; min-width: 32px; }
#components-container .allowance-custom { position: relative; flex: 0 0 80px; min-width: 0; width: 80px; height: 36px; }
#components-container .allowance-custom .allowance-rate-input { appearance: textfield; height: 100% !important; background: transparent; padding: 6px 4px 6px 7px; }
#components-container .allowance-custom .allowance-rate-input,
#components-container .allowance-fixed { font-size: var(--node-rate-font-size) !important; font-weight: 400; }
.allowance-custom-caption { position: absolute; top: -24px; left: 0; font-size: 11px; line-height: 18px; white-space: nowrap; }
.quantity-entry-hint { display: block; font-size: 10px; color: #64748b; }
#components-container .component-note-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; margin: 8px 0 12px; }
.component-note-actions .production-note-button { grid-column: 2; grid-row: 1; }
.component-note-actions .allowance-calculation-details { margin: 0; min-width: 0; }
.component-note-actions .allowance-calculation-details summary { grid-column: 1; grid-row: 1; align-self: center; padding: 5px 0; font-size: 12px; }
.component-note-actions .allowance-calculation-hint { grid-column: 1 / -1; padding: 9px 10px; margin: 0; border-radius: 6px; background: #f1f5f9; font-size: 12px; }
.allowance-save-status { margin: 8px 0 0; font-size: 11px; color: #64748b; }
.tracking-settings-locked .settings-entry-hint { visibility: hidden; }
.tracking-settings-locked .allowance-custom-caption { visibility: hidden; }
.dark #components-container .component-image-frame, .dark .component-note-actions .allowance-calculation-hint { background: #1e293b; border-color: #435a78; }
.dark .quantity-entry-hint, .dark .allowance-save-status { color: #94a3b8; }
/* Component-level node copy and preview. */
#components-container .component-node-actions { display: flex; gap: 8px; width: 100%; grid-column: 1 / -1; }
#components-container .component-node-actions .add-process-card-btn { flex: 1; width: auto; min-width: 0; margin: 0; white-space: nowrap; }
#components-container :is(.copy-process-cards-btn, .component-accessory-add) { flex: 0 0 auto; padding: 8px 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #fff; color: #2563eb; font-size: 14px; font-weight: 600; white-space: nowrap; }
#components-container :is(.copy-process-cards-btn, .component-accessory-add):hover { background: #eff6ff; }
#components-container .component-accessory-add:disabled,
#components-container .component-accessory-add:disabled:hover { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; cursor: not-allowed; box-shadow: none; }
.dark #components-container .component-accessory-add:disabled,
.dark #components-container .component-accessory-add:disabled:hover { background: #253244; color: #718096; border-color: #334155; }
.copy-nodes-panel { padding: 24px; max-height: 90vh; overflow-y: auto; }
.copy-nodes-panel > p { margin: 12px 0; font-size: 13px; line-height: 1.6; color: #64748b; }
.copy-nodes-panel label { display: block; margin-bottom: 6px; font-weight: 600; }
#copy-nodes-preview table { width: 100%; font-size: 14px; border-collapse: collapse; }
#copy-nodes-preview th, #copy-nodes-preview td { padding: 9px 6px; text-align: left; border-bottom: 1px solid #e2e8f0; overflow-wrap: anywhere; }
#copy-nodes-preview p { margin-top: 12px; font-size: 13px; color: #2563eb; }
.copy-nodes-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
#confirm-copy-nodes-btn:disabled { opacity: .45; cursor: default; }
.dark #components-container :is(.copy-process-cards-btn, .component-accessory-add) { background: #1e293b; color: #93c5fd; border-color: #334155; }

/* Production nodes: clear metrics, soft elevation and reachable actions. */
#components-container .process-cards-container { container-type: inline-size; gap: 8px !important; }
#components-container :is(.process-card, .accessory-node-card) {
    font-family: 'Inter', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
    --node-ink: #203b58; --node-muted: #62768d; --node-line: #dce6f1;
    --node-surface: #fff; --node-field: #f6f9fd; --node-blue: #2863ad;
    margin-bottom: 0 !important; border-radius: 10px !important; border-color: var(--node-line) !important; background: var(--node-surface);
    box-shadow: 0 2px 4px #244c7810, 0 8px 20px -8px #244c7826 !important;
    transition: border-color .18s ease, box-shadow .18s ease;
}
#components-container :is(.process-card, .accessory-node-card):hover { border-color: #b7cde5 !important; box-shadow: 0 3px 6px #244c7810, 0 10px 24px -8px #244c7833 !important; }
#components-container :is(.process-card, .accessory-node-card):focus-within { border-color: #7ea8df !important; box-shadow: 0 0 0 3px #3b82f614, 0 8px 20px -8px #244c7826 !important; }
#components-container :is(.process-card, .accessory-node-card) > header { flex-wrap: wrap; gap: 6px; min-height: 42px; padding: 8px 10px 6px !important; border: 0; background: transparent !important; }
#components-container .process-heading { display: flex; align-items: center; flex: 1 1 90px; gap: 6px; min-width: 0; }
#components-container .process-step-number { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px; background: #edf4fc; color: var(--node-blue); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
#components-container :is(.process-card, .accessory-node-card) .process-title { font-size: 14px !important; font-weight: 600; line-height: 1.5; color: var(--node-ink); white-space: normal; overflow-wrap: anywhere; }
#components-container .process-card-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
#components-container .process-reorder { display: flex; flex-direction: row; gap: 2px; padding: 2px; border: 1px solid var(--node-line); background: var(--node-field); border-radius: 9px; }
#components-container .process-reorder button, #components-container :is(.process-card, .accessory-node-card) .delete-card-btn { display: grid; place-items: center; width: 24px; height: 24px; min-height: 24px; padding: 0; border: 0; background: transparent; border-radius: 6px; color: var(--node-muted); }
#components-container .process-reorder button:hover:not(:disabled) { background: #e4eefc; color: #245da5; }
#components-container :is(.process-card, .accessory-node-card) .delete-card-btn { margin-left: 2px; }
#components-container :is(.process-card, .accessory-node-card) .delete-card-btn:hover:not(:disabled) { color: #c43546; background: #fff0f2; }
#components-container :is(.process-card, .accessory-node-card) button:disabled { opacity: .35; cursor: not-allowed; }
#components-container :is(.process-card, .accessory-node-card) .production-settings-body { padding: 0 10px 10px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row { display: grid; grid-template-columns: minmax(0, 1fr) 86px; align-items: end; gap: 10px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row > *, #components-container :is(.process-card, .accessory-node-card) .allowance-rate-group { min-width: 0; }
#components-container :is(.process-card, .accessory-node-card) .allowance-label, #components-container :is(.process-card, .accessory-node-card) [data-key-text="targetQuantityText"] { display: block; color: var(--node-muted); font-size: 12px; line-height: 18px; margin: 0 0 4px; white-space: normal; overflow-wrap: anywhere; }
#components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row .target-quantity-input { height: 36px !important; min-height: 36px; margin: 0; padding: 5px 9px; border-radius: 7px; font-size: 19px !important; font-weight: 700; line-height: 28px; color: var(--node-ink); background: var(--node-field); border-color: var(--node-line); font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 2px #244c7805; }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom { flex: 1 1 auto; width: 100%; min-width: 0; height: 36px; margin: 0; border-radius: 7px; background: var(--node-field); border-color: var(--node-line); padding-right: 10px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom input { height: 34px !important; min-height: 0; padding: 5px 0 5px 9px !important; border: 0; border-radius: 9px; background: transparent; font-size: 15px !important; font-weight: 600; color: var(--node-ink); font-variant-numeric: tabular-nums; }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom > span { font-size: 13px; color: var(--node-muted); }
#components-container :is(.process-card, .accessory-node-card) .allowance-fixed { display: flex; align-items: center; gap: 0; width: 100%; height: 36px; min-height: 36px; padding: 5px 10px 5px 9px; border: 1px solid transparent; border-radius: 7px; background: var(--node-field); font-size: 13px !important; font-weight: 400; line-height: 24px; color: var(--node-muted); font-variant-numeric: tabular-nums; }
#components-container :is(.process-card, .accessory-node-card) .allowance-fixed-value { flex: 1; font-size: 15px; font-weight: 600; color: var(--node-ink); }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom input:disabled { opacity: 1; -webkit-text-fill-color: var(--node-ink); }
#components-container :is(.process-card, .accessory-node-card) .yield-flow-hint { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 4px; margin: 5px 0 0; padding: 0; border-radius: 0; background: transparent; font-size: 11px; line-height: 1.6; color: var(--node-muted); overflow-wrap: anywhere; }
#components-container .yield-flow-value { margin-left: 0; font-size: 11px; line-height: 1.6; font-weight: 400; color: var(--node-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#components-container .yield-flow-note { flex-basis: 100%; font-size: 11px; color: var(--node-muted); }
#components-container :is(.process-card, .accessory-node-card) .allowance-save-status { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 0; color: #966019; font-size: 12px; line-height: 1.6; }
#components-container .allowance-save-status::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: #d99a35; }
#components-container :is(.process-card, .accessory-node-card):has(.allowance-save-status:not([hidden])) { border-color: #e6c68e !important; }
#components-container :is(.process-card, .accessory-node-card) button:focus-visible, #components-container :is(.process-card, .accessory-node-card) input:focus-visible { outline: 2px solid #5087d0; outline-offset: 2px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom:focus-within { outline: 2px solid #5087d0; outline-offset: 2px; }
#components-container :is(.process-card, .accessory-node-card) .allowance-custom input:focus-visible { outline: none; box-shadow: none; }
.tracking-settings-locked #components-container :is(.process-card, .accessory-node-card) .target-quantity-input, .tracking-settings-locked #components-container :is(.process-card, .accessory-node-card) .allowance-custom { border-color: transparent; background: var(--node-field); }
.tracking-settings-locked #components-container :is(.process-card, .accessory-node-card) .allowance-custom input { opacity: 1; color: var(--node-ink); -webkit-text-fill-color: var(--node-ink); }
.dark #components-container :is(.process-card, .accessory-node-card) { --node-ink: #e0eaf7; --node-muted: #a7b8ce; --node-line: #3a4d66; --node-surface: #1e2d40; --node-field: #182638; --node-blue: #a6c9ff; box-shadow: 0 3px 6px #07111f26, 0 10px 24px -8px #07111f66 !important; }
.dark #components-container .process-step-number { background: #263b55; }
.dark #components-container .process-reorder button:hover:not(:disabled) { background: #34547a; color: #e0edff; }
.dark #components-container :is(.process-card, .accessory-node-card) .allowance-save-status { color: #efc487; }
.dark #components-container :is(.process-card, .accessory-node-card) .delete-card-btn:hover:not(:disabled) { background: #50303d; color: #ffb1bb; }
#components-container :is(.process-card, .accessory-node-card) [hidden] { display: none !important; }
@container (max-width: 280px) {
    #components-container :is(.process-card, .accessory-node-card) > header { gap: 8px; }
    #components-container .process-reorder { margin-left: auto; }
    #components-container :is(.process-card, .accessory-node-card) .allowance-quantity-row { grid-template-columns: minmax(0, 1fr) 90px; gap: 12px; }
}
@media (pointer: coarse), (max-width: 767px) {
    #components-container .process-reorder button, #components-container :is(.process-card, .accessory-node-card) .delete-card-btn { width: 44px; height: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { #components-container :is(.process-card, .accessory-node-card) { transition: none; } }
.dark .copy-nodes-panel > p { color: #94a3b8; }
@media (max-width: 600px) {
    #components-container .component-node-actions { grid-row: 3; gap: 6px; }
    #components-container .component-node-actions button { min-height: 40px; font-size: 13px !important; }
    .copy-nodes-panel { padding: 18px; }
}

.tracking-edit-actions { display: flex; align-items: center; gap: 8px; }
#page-tracking #tracking-cancel-edit { min-height: 44px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: white; color: #475569; font-size: 13px; white-space: nowrap; }
#page-tracking #tracking-cancel-edit[hidden] { display: none; }
@media (max-width: 900px) {
    #page-tracking .tracking-edit-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 560px) {
    #page-tracking.tracking-settings-editing .tracking-edit-actions { grid-column: 1 / -1; grid-row: 2; justify-content: flex-end; }
}
.dark #page-tracking #tracking-cancel-edit { background: #334155; border-color: #64748b; color: #e2e8f0; }
/* Yield-based quantities: one editable rate or a fixed text value. */
#components-container .allowance-custom[hidden], .allowance-fixed[hidden] { display: none !important; }
.allowance-fixed { display: flex; align-items: center; min-height: 36px; color: #475569; }
.yield-flow-hint, .yield-shared-summary { margin: 9px 0 0; font-size: 12px; line-height: 1.6; color: #64748b; }
.dark .allowance-fixed, .dark .yield-flow-hint { color: #cbd5e1; }

.component-product-info { grid-column: 1 / -1; min-width: 0; color: #476582; font-size: 12px; line-height: 1.6; }
.component-product-code, .component-product-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.component-product-code { font-weight: 600; }
.dark .component-product-info { color: #adc6e5; }
/* The creation dialog pairs compact order fields with the PDF product list.
   Keep the shared inline setup and existing-order editor in their own layouts. */
.order-products-empty { display: none; }
.order-draft-note { display: none; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-basic-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-draft-note { display: inline-block; flex-shrink: 0; }
.order-draft-note .pdf-note-icon { font-weight: 400; white-space: nowrap; }
.order-draft-note .pdf-note-icon.has-note { border-color: #8db8ee; background: #e5f0ff; color: #1659a7; }
.order-draft-note textarea { display: block; width: 100%; margin: 8px 0 4px; padding: 8px; border: 1px solid #ccdaea; border-radius: 6px; background: white; color: #243951; font-size: 13px; font-weight: 400; line-height: 1.7; resize: vertical; }
.order-draft-note small { color: #72849a; font-size: 11px; font-weight: 400; }
.dark .order-draft-note textarea { background: #243447; color: #dce9fa; border-color: #435a78; }
.dark .order-draft-note .pdf-note-icon.has-note { background: #263e57; color: #bfdbfe; border-color: #619bec; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .viewport-modal-panel { max-width: 1160px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results:empty + .order-products-empty { display: flex; flex-direction: column; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty { min-width: 0; padding: 16px; border: 1px dashed #cfdeee; border-radius: 10px; background: #f8fafd; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty h4 { color: #506982; font-size: 14px; font-weight: 700; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty > div { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 20px; text-align: center; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty strong { color: #506982; font-size: 15px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty p { max-width: 330px; margin-top: 10px; color: #72849a; font-size: 13px; line-height: 1.8; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty span { margin-top: 16px; color: #72849a; font-size: 12px; line-height: 1.7; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results { min-width: 0; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results:empty { display: none; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-list-heading { flex-wrap: wrap; gap: 4px 12px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) 78px auto; gap: 6px 10px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields .pdf-note-wrap { grid-column: auto; margin: 0 0 5px; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-photo { align-self: start; padding-top: 4px; }
.dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty { background: #1e293b; border-color: #435a78; }
.dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty h4, .dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty strong { color: #deebfc; }
.dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty p, .dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty span { color: #a8bad0; }
@media (min-width: 960px) {
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #add-order-form-modal { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; gap: 16px 24px; align-items: start; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #add-order-form-modal > :not([hidden]) ~ :not([hidden]) { margin-top: 0; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-order-import { grid-column: 1 / -1; grid-row: 1; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-basic-heading { grid-column: 1; grid-row: 2; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-identity-grid { grid-column: 1; grid-row: 3; grid-template-columns: minmax(0, 1fr); }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-details-grid { grid-column: 1; grid-row: 4; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-identity-grid > div, #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-details-grid > div { min-width: 0; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results, #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty { grid-column: 2; grid-row: 2 / 6; align-self: stretch; min-height: 340px; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results { max-height: min(480px, calc(100dvh - 300px)); overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 2px 20px; border-left: 1px solid #e2eaf4; scrollbar-gutter: stable; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-list-heading { margin-top: 0; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-warnings:first-child { margin-top: 0; }
    .dark #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-results { border-color: #435a78; }
}
@media (min-width: 960px) and (max-width: 1100px) {
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #add-order-form-modal { grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields { grid-template-columns: minmax(0, 1fr) 80px auto; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields > label { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields { grid-template-columns: minmax(0, 1fr) 80px; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-product-fields .pdf-note-wrap { grid-column: 1 / -1; margin: 0; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty > div { padding: 24px 8px; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .order-products-empty span { display: none; }
}
#production-pdf-warnings:empty { display: none; }
/* Give the primary product and component editors the available page width. */
#page-tracking > .container { max-width: none; }
#add-component-form .component-create-actions { flex-wrap: wrap; gap: 8px; margin-top: auto; }
#add-component-form .component-create-actions > button { padding: 0 12px !important; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-warnings { min-width: 0; }
#add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-warnings .pdf-warnings { margin: 0; padding: 8px 12px 8px 26px; overflow-wrap: anywhere; }
@media (min-width: 1101px) {
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-order-import:has(#production-pdf-warnings:not(:empty)) .pdf-import-heading { display: grid; grid-template-columns: minmax(200px, .9fr) minmax(0, 1.6fr) auto; gap: 16px; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-warnings { grid-column: 2; grid-row: 1; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) .pdf-import-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 1100px) {
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-order-import .pdf-import-heading { flex-wrap: wrap; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-order-import .pdf-import-actions { margin-left: auto; }
    #add-order-modal:not(.inline-order-setup):has(#production-order-import:not([hidden])) #production-pdf-warnings { flex-basis: 100%; }
}
@media (max-width: 760px) {
    #add-order-modal:not(.inline-order-setup) .order-identity-grid > div > label { min-height: 44px; display: flex; align-items: center; margin-bottom: 0; }
    #add-order-modal:not(.inline-order-setup) .order-name-label label { margin-bottom: 0; }
}

#page-tracking .tracking-edit-actions[hidden] { display: none; }
#page-tracking [data-tracking-edit-trigger]:not(:disabled) { cursor: pointer; }
#page-tracking.tracking-settings-editing input[data-tracking-edit-trigger]:not(:disabled), #page-tracking.tracking-settings-editing textarea[data-tracking-edit-trigger]:not(:disabled) { cursor: text; }
