.bom-quick-search {
    position: relative;
    align-items: center;
}

.bom-quick-search i {
    position: absolute;
    inset-inline-start: 0.75rem;
    pointer-events: none;
}

.bom-quick-search .form-control {
    width: 15rem;
    padding-inline-start: 2.25rem;
}

.bom-tree > :not(caption) > * > * {
    padding-block: 0.3rem;
}

.bom-search {
    max-width: 32rem;
}

.bom-tree-wrap {
    max-height: calc(100vh - 16rem);
    overflow: auto;
}

.bom-tree thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.bom-tree .bom-item {
    padding-inline-start: calc(0.5rem + var(--bom-level, 0) * 1.25rem);
}

.bom-toggle,
.bom-toggle-spacer {
    display: inline-flex;
    width: 1.25rem;
    justify-content: center;
}

.bom-toggle {
    padding: 0;
    border: 0;
    background: none;
    color: var(--theme-secondary-color);
}

.bom-toggle i {
    transition: transform 0.15s;
}

.bom-toggle[aria-expanded='true'] i {
    transform: rotate(90deg);
}

.bom-toggle.htmx-request i {
    animation: spin 0.8s linear infinite;
}

.bom-tree .bom-description {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bom-tree > tbody > tr.bom-match > td {
    background-color: var(--theme-warning-bg-subtle);
}

.bom-tree > tbody > tr.bom-selected > td {
    background-color: var(--theme-primary-bg-subtle);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 1200px) {
    .bom-properties {
        position: sticky;
        top: calc(var(--theme-topbar-height, 65px) + 1rem);
    }

    .bom-properties .card-body {
        max-height: calc(100vh - 16rem);
        overflow: auto;
    }
}

.bom-props {
    font-size: 0.8125rem;
}

.bom-props section {
    margin-top: 1rem;
}

.bom-props .section-heading {
    margin-bottom: 0.4rem;
}

.bom-props dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.15rem 0.75rem;
    margin-bottom: 0;
}

.bom-props dl + dl {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--theme-border-color);
}

.bom-props dt {
    font-weight: normal;
    color: var(--theme-secondary-color);
}

.bom-props dd {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.bom-tree .bom-row {
    cursor: pointer;
}

/* DataTables right-aligns columns it detects as numbers, such as item numbers; real number columns use .text-end. */
table.dataTable th.dt-type-numeric,
table.dataTable td.dt-type-numeric {
    text-align: start;
}

.bom-tree > tbody > tr.bom-removed > td {
    background-color: var(--theme-danger-bg-subtle);
}

.bom-tree .bom-removed .bom-item span {
    text-decoration: line-through;
}

.bom-tree > tbody > tr.bom-added > td {
    background-color: var(--theme-success-bg-subtle);
}

.bom-tree > tbody > tr.bom-qty-changed > td {
    background-color: var(--theme-warning-bg-subtle);
}

/* The item properties panel can be hidden on wide screens to give the BOM the full width, like the legacy east panel. */
.bom-panel-show {
    display: none;
}

@media (min-width: 1200px) {
    .bom-panel-hidden .bom-panel-show {
        display: inline-flex;
    }

    .bom-panel-hidden [data-bom-layout] > .bom-tree-column {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .bom-panel-hidden [data-bom-layout] > .bom-panel-column {
        display: none;
    }
}

.bom-tree .bom-description {
    max-width: 18rem;
}

.bom-panel-hidden .bom-tree .bom-description {
    max-width: 30rem;
}

.bom-edit-table .bom-edit-seq { width: 7rem; }
.bom-edit-table .bom-edit-item { width: 13rem; }
.bom-edit-table .bom-edit-qty { width: 9rem; }

.bom-line-removed td { opacity: 0.5; }
.bom-line-removed input:not([type=checkbox]) { text-decoration: line-through; }

.bom-batch-ecn { width: 16rem; }
