.model-browser.bom-grid-enabled { grid-template-rows: auto minmax(0, 1fr) 28px auto; }
.bom-grid-viewport { overflow: auto; min-width: 0; min-height: 0; scrollbar-gutter: stable; }
.bom-grid-enabled .browser-tree { overflow: visible; padding: 0 0 12px; width: max(100%, var(--bom-grid-width)); }
.bom-grid-enabled .bom-table-header,
.bom-grid-enabled .browser-tree summary,
.bom-grid-enabled .browser-tree .tree-item {
    grid-template-columns: var(--bom-grid-tracks) !important;
    gap: 0; padding: 0; width: max(100%, var(--bom-grid-width)); box-sizing: border-box;
    border-radius: 0; min-height: 24px; border-bottom: 1px solid var(--bom-grid-line);
}
.bom-grid-enabled .bom-table-header { top: 0; min-height: 30px; z-index: 8; }
.bom-grid-enabled .browser-tree details { margin: 0; padding: 0; }
.bom-grid-enabled .bom-part-number,
.bom-grid-enabled .bom-description-text,
.bom-grid-enabled .bom-artnr,
.bom-grid-enabled .bom-pcs,
.bom-grid-enabled .bom-price,
.bom-grid-enabled .bom-unit,
.bom-grid-enabled .bom-value,
.bom-grid-enabled .bom-weight {
    box-sizing: border-box; min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; align-self: stretch; align-items: center; padding: 4px 5px;
    border-left: 1px solid var(--bom-grid-line); line-height: 16px;
}
.bom-grid-enabled .bom-part-number { padding-left: calc(5px + var(--bom-tree-depth, 0) * 8px); }
.bom-grid-enabled .browser-tree summary::before,
.bom-grid-enabled .browser-tree .tree-item::before { margin: 7px auto 0; }
.bom-grid-enabled .bom-table-header > span { position: relative; padding: 4px 23px 4px 5px; display: flex; align-items: center; border-left: 1px solid var(--bom-grid-line); overflow: hidden; }
.bom-grid-enabled .bom-header-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.bom-grid-enabled .bom-column-filter { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; padding: 2px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--text); opacity: 0; cursor: pointer; }
.bom-filter-chevron { width: 10px; height: 10px; background: var(--icon-bom-fold) center / contain no-repeat; transform: rotate(90deg); }
.bom-table-header > span:hover .bom-column-filter,
.bom-table-header > span:focus-within .bom-column-filter,
.bom-table-header > span.is-filtered .bom-column-filter,
.bom-table-header > span[aria-sort="ascending"] .bom-column-filter,
.bom-table-header > span[aria-sort="descending"] .bom-column-filter { opacity: 1; }
.bom-table-header > span.is-filtered .bom-column-filter { border-color: #22c55e; background: color-mix(in srgb, #22c55e 25%, var(--panel)); }
.bom-table-header > span[aria-sort="ascending"] .bom-filter-chevron { transform: rotate(-90deg); }
.bom-column-resize { position: absolute; right: -2px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 3; touch-action: none; }
.bom-column-resize:hover, .bom-column-resize:focus { background: #38bdf8; outline: none; }
.bom-grid-enabled .bom-filter-hidden { display: none !important; }
.bom-grid-enabled .bom-filter-ancestor { color: var(--muted); }
.bom-filtered-total { min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 6px; font-size: 10px; background: var(--panel); }
.bom-filtered-total.is-active { border-top: 1px solid var(--line); color: var(--text); }
.bom-filtered-total strong { margin-right: auto; font-size: 10px; white-space: nowrap; }
.bom-clear-filter { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 2px; }
.bom-grid-enabled .bom-total-row { display: flex !important; justify-content: flex-end; gap: 6px; min-width: 0; }
.bom-grid-enabled .bom-total-row > span:empty { display: none; }
.bom-grid-enabled .bom-total-row > span:nth-child(2) { margin-right: auto; }
.bom-grid-enabled .bom-total-price-status { max-width: 45%; font-size: 9px; }
.bom-filter-popup { position: fixed; z-index: 15000; width: 264px; max-width: calc(100vw - 12px); max-height: calc(100vh - 16px); overflow: auto; box-sizing: border-box; padding: 8px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 22px #0005; font-size: 12px; }
.bom-filter-popup[hidden] { display: none; }
.bom-filter-popup { display: flex; flex-direction: column; overflow: hidden; }
.bom-filter-popup > * { flex-shrink: 0; }
.bom-filter-popup > .bom-filter-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: auto; }
.bom-filter-content > * { flex-shrink: 0; }
.bom-filter-popup.is-resized .bom-filter-values { flex: 1 1 70px; max-height: none; }
.bom-filter-actions > .bom-filter-resize { position: absolute; right: -8px; bottom: -8px; width: 20px; height: 20px; padding: 0; cursor: nwse-resize; touch-action: none; color: #354766; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
body[data-theme="day"] .bom-filter-actions > .bom-filter-resize { color: #61758f; }
.bom-filter-actions > .bom-filter-resize:hover { background: transparent; }
.bom-filter-resize span { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.bom-filter-resize span:nth-child(1) { right: 1px; bottom: 8px; }
.bom-filter-resize span:nth-child(2) { right: 6px; bottom: 2px; }
.bom-filter-resize span:nth-child(3) { right: 1px; bottom: 2px; }
.bom-filter-resize:focus-visible { outline: 1px solid #38bdf8; }
.bom-filter-title { display: block; margin-bottom: 5px; overflow-wrap: anywhere; }
.bom-filter-content > button { width: 100%; text-align: left; border: 0; padding: 6px; border-radius: 2px; background: transparent; color: inherit; }
.bom-filter-popup button:hover { background: color-mix(in srgb, #38bdf8 20%, var(--panel)); }
.bom-filter-popup button:disabled { opacity: .45; }
.bom-filter-popup input:not([type="checkbox"]), .bom-filter-popup select { box-sizing: border-box; width: 100%; padding: 5px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 2px; font-size: 12px; min-height: 27px; }
.bom-filter-condition { display: grid; gap: 4px; margin: 6px 0; border-top: 1px solid var(--line); padding-top: 6px; }
.bom-filter-popup input[hidden] { display: none; }
.bom-filter-values { max-height: 180px; min-height: 70px; overflow: auto; border: 1px solid var(--line); padding: 3px; }
.bom-filter-values label, .bom-filter-all { display: flex; gap: 5px; align-items: center; min-height: 24px; cursor: pointer; }
.bom-filter-values label span { overflow-wrap: anywhere; min-width: 0; }
.bom-filter-popup input[type="checkbox"] { margin: 3px; width: 14px; height: 14px; flex: 0 0 14px; accent-color: #22c55e; }
.bom-filter-actions { display: flex; position: relative; justify-content: flex-end; gap: 6px; padding: 8px 18px 0 0; }
.bom-filter-actions button { border: 1px solid var(--line); padding: 4px 12px; border-radius: 3px; background: var(--panel2); color: var(--text); }
.bom-grid-enabled .browser-tree [role="row"]:focus-visible { outline: 1px solid #38bdf8; outline-offset: -1px; }
.preferences-reference-lines { display: grid; gap: 10px; padding: 12px 0; }
.preferences-reference-lines label { display: flex; gap: 8px; align-items: center; }
.bom-grid-enabled :is(#bomPartNumberHeader,.bom-part-number) { grid-column: var(--bom-column-part); grid-row: 1; }
.bom-grid-enabled :is(#bomDescriptionHeader,.bom-description-text) { grid-column: var(--bom-column-description); grid-row: 1; }
.bom-grid-enabled :is(#bomArticleHeader,.bom-artnr) { grid-column: var(--bom-column-article); grid-row: 1; }
.bom-grid-enabled :is(#bomPcsHeader,.bom-pcs) { grid-column: var(--bom-column-qty); grid-row: 1; }
.bom-grid-enabled :is(#bomPriceHeader,.bom-price) { grid-column: var(--bom-column-price); grid-row: 1; }
.bom-grid-enabled :is(#bomUnitHeader,.bom-unit) { grid-column: var(--bom-column-unit); grid-row: 1; }
.bom-grid-enabled :is(#bomValueHeader,.bom-value) { grid-column: var(--bom-column-value); grid-row: 1; }
.bom-grid-enabled :is(#bomWeightHeader,.bom-weight) { grid-column: var(--bom-column-weight); grid-row: 1; }
.bom-grid-enabled .browser-tree :is(summary,.tree-item)::before { grid-column: 1; grid-row: 1; }
.bom-table-header [data-bom-column] { touch-action: none; cursor: grab; user-select: none; }
.bom-table-header [data-bom-column].is-dragging { opacity: .5; cursor: grabbing; }
.bom-column-drop-line { position: fixed; width: 1px; background: #ff001a; z-index: 15001; pointer-events: none; }
.bom-column-drop-line[hidden] { display: none; }
