.bom-open-group {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.bom-title-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.bom-title-button:hover,
.bom-title-button:focus-visible {
  color: var(--blue);
  text-decoration: underline;
  outline: 0;
}

.bom-dialog {
  width: min(1500px, calc(100vw - 40px));
  max-width: none;
  max-height: 92vh;
}

.bom-detail-panel {
  padding: 23px;
}

.bom-price-total strong {
  color: var(--blue);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.bom-price-total span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.bom-price-total .bom-price-warning {
  color: #946200;
}

.bom-detail-table {
  max-height: calc(92vh - 230px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bom-detail-table table {
  min-width: 1280px;
}

.bom-detail-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.bom-detail-table tbody tr:hover {
  background: #f8fbff;
}

.bom-ledger table {
  min-width: 1120px;
}

.bom-ledger td:last-child,
.bom-ledger th:last-child {
  text-align: right;
}

.bom-ledger .action-group {
  flex-wrap: nowrap;
}

.bom-template-table table {
  min-width: 1280px;
}

.bom-sequence,
.bom-child {
  white-space: nowrap;
}

.bom-level,
.bom-attribute {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
}

.bom-level {
  min-width: 28px;
  justify-content: center;
  color: #2467d5;
  background: #eaf2ff;
  font-weight: 700;
}

.bom-level.level-2 {
  margin-left: 14px;
  color: #865615;
  background: #fff2d9;
}

.bom-attribute {
  color: #40536d;
  background: #f0f4f9;
}

.bom-unit-price {
  min-width: 110px;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bom-remark {
  min-width: 120px;
}

.bom-change-dialog {
  width: min(1540px, calc(100vw - 28px));
  max-width: none;
  max-height: 94vh;
}

.bom-change-dialog form {
  padding: 22px;
}

.bom-change-fields {
  grid-template-columns:repeat(4,1fr);
}

.bom-change-fields .form-span-2 {
  grid-column: span 2;
}

.bom-change-section {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.bom-change-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background: #f8fafc;
}

.bom-change-toolbar h3,
.bom-change-toolbar small {
  display: block;
  margin: 0;
}

.bom-change-toolbar h3 {
  font-size: 14px;
}

.bom-change-toolbar small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.bom-change-table {
  max-height: 45vh;
  overflow: auto;
}

.bom-change-table table {
  min-width: 1740px;
}

.bom-change-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.bom-change-table th,
.bom-change-table td {
  padding: 7px 8px;
  vertical-align: top;
}

.bom-change-table input,
.bom-change-table select {
  min-width: 74px;
  margin: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.bom-change-table .bom-change-material {
  min-width: 300px;
}

.bom-change-table .bom-change-attribute,
.bom-change-table .bom-change-price,
.bom-change-table .bom-create-price,
.bom-change-table .bom-change-vendor {
  min-width: 120px;
}

.bom-change-table .bom-change-remark {
  min-width: 190px;
}

.bom-change-spec {
  display: block;
  max-width: 300px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: normal;
}

.bom-change-remove {
  border-color: #efcccc;
  color: #bf4141;
  white-space: nowrap;
}

.bom-change-history table {
  min-width: 1100px;
}

.bom-create-dialog,
.bom-change-dialog {
  width: min(1500px, calc(100vw - 28px));
  max-height: 94vh;
}

.bom-create-dialog form {
  padding: 22px;
}

.bom-create-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 13px;
}

.bom-create-mode {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.bom-create-mode strong,
.bom-create-mode small {
  display: block;
}

.bom-create-mode small {
  margin-top: 4px;
  color: var(--muted);
}

.bom-create-mode.active {
  border-color: #77aeea;
  background: #eaf3ff;
  color: #1f64ad;
  box-shadow: 0 0 0 2px rgb(44 120 205 / 8%);
}

.bom-import-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  padding: 12px 14px;
  border: 1px dashed #a9c8e9;
  border-radius: 8px;
  background: #f5f9fe;
}

.bom-import-panel[hidden] {
  display: none;
}

.bom-import-panel strong,
.bom-import-panel small {
  display: block;
}

.bom-import-panel small {
  margin-top: 4px;
  color: var(--muted);
}

.bom-file-picker {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--blue);
  color: white;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
}

.bom-file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.bom-import-status {
  grid-column: 1 / -1;
  color: #60758b;
  font-size: 11px;
  line-height: 1.55;
}

.bom-import-status.success { color: #13815f; }
.bom-import-status.warning { color: #9b670e; }
.bom-import-status.error { color: #c54848; }

.bom-create-fields {
  grid-template-columns: repeat(5, 1fr);
}

.bom-create-fields .form-span-2 {
  grid-column: span 2;
}

.bom-create-remove {
  border-color: #efcccc;
  color: #bf4141;
  white-space: nowrap;
}

@media (max-width: 850px) {
  .bom-open-group {
    gap: 8px;
  }

  .bom-change-fields {
    grid-template-columns: 1fr 1fr;
  }

  .bom-create-fields {
    grid-template-columns: 1fr 1fr;
  }

  .bom-import-panel {
    grid-template-columns: 1fr;
  }

  .bom-import-status,
  .bom-create-fields .form-span-2 {
    grid-column: 1 / -1;
  }

  .bom-change-fields .form-span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .bom-create-modes,
  .bom-create-fields {
    grid-template-columns: 1fr;
  }
}
