.material-consumption-badge[data-order-bom] { cursor: pointer; }

dialog.order-bom {
    width: min(920px, calc(100vw - 24px));
    max-height: min(84dvh, 850px);
    max-width: none;
    padding: 0;
    border: 1px solid #d4e0ec;
    border-radius: 14px;
    background: #fff;
    color: #26374b;
    overflow: hidden;
}

dialog.order-bom[open] {
    display: flex;
    flex-direction: column;
}

.order-bom::backdrop { background: #172b4266; }

.order-bom-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #d4e0ec;
}

.order-bom-header h2 { margin: 0; font-size: 18px; }
.order-bom-meta { margin: 4px 0 0; color: #526982; font-size: 13px; }

.order-bom-header .order-bom-close {
    flex: none;
    min-width: 36px;
    min-height: 36px;
    padding: 0 7px;
    border-radius: 8px;
    font-size: 21px;
}

.order-bom-body {
    overflow: auto;
    overscroll-behavior: contain;
}

.order-bom-position + .order-bom-position { border-top: 1px solid #cfdde9; }

.order-bom-position > header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 9px 16px;
    background: #f0f5fa;
    overflow-wrap: anywhere;
}

.order-bom-position h3 { margin: 0; font-size: 14px; }
.order-bom-position > header > span { color: #526982; font-size: 12px; }

.order-bom table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
    line-height: 1.35;
}

.order-bom table :is(th, td) {
    padding: 6px 10px;
    border-bottom: 1px solid #e1e9f1;
    text-align: left;
    vertical-align: middle;
    white-space: normal;
    letter-spacing: normal;
    text-transform: none;
    overflow-wrap: anywhere;
}

.order-bom table th:first-child { width: 43%; padding-inline-start: 16px; }
.order-bom table th:last-child { width: 25%; }
.order-bom table thead th { color: #3e5973; background: #f7f9fc; font-size: 12px; }
.order-bom table tbody th { font-weight: 400; }
.order-bom table tbody tr:nth-child(even) { background: #f7f9fc; }
.order-bom table tbody tr:last-child > * { border-bottom: 0; }
.order-bom table small { display: block; color: #526982; }

.order-bom-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 650;
}

.order-bom-status.enough { background: #e7f2ec; color: #246548; }
.order-bom-status.short { background: #fbedec; color: #9b3c33; }
.order-bom-status.neutral { color: #526982; }
.order-bom-state { margin: 0; padding: 12px 16px; color: #526982; font-size: 14px; }
.order-bom-retry { margin: 0 16px 12px; }

.order-bom button:focus-visible,
.material-consumption-badge[data-order-bom]:focus-visible {
    outline: 2px solid #245d92;
    outline-offset: -2px;
}

@media (max-width: 600px) {
    .order-bom-header,
    .order-bom-position > header { padding-inline: 10px; }
    .order-bom table :is(th, td) { padding-inline: 4px; }
    .order-bom table th:first-child { width: 34%; padding-inline-start: 10px; }
    .order-bom table th:last-child { width: 26%; }
    .order-bom table,
    .order-bom table thead th,
    .order-bom-status { font-size: 11px; }
}
