/* Order preview stays inside the calculator's single scrolling surface. */
.bc-dialog .bc-order {
  margin: 12px 32px 28px;
  padding-top: 24px;
  border-top: 1px solid var(--bc-line);
  min-width: 0;
}

.bc-dialog .bc-order-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.bc-dialog .bc-order-head h3 { margin: 0; }
.bc-dialog .bc-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  min-height: 27px;
  padding: 2px 8px;
  border: 1px solid var(--bc-gold);
  border-radius: 20px;
  color: var(--bc-gold);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bc-dialog .bc-order-new {
  margin-left: auto;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--bc-line);
  border-radius: 24px;
  background: transparent;
  color: var(--bc-ink);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.bc-dialog .bc-order-new:hover { border-color: var(--bc-gold); }
.bc-dialog .bc-order-empty {
  padding: 18px 20px;
  border: 1px dashed var(--bc-line);
  color: var(--bc-muted);
  font-size: 14px;
}
.bc-dialog .bc-order-table-wrap { min-width: 0; }
.bc-dialog .bc-order-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--bc-ink);
  font-size: 14px;
  line-height: 1.45;
}
.bc-dialog .bc-order-table th {
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--bc-line);
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  color: var(--bc-muted);
}
.bc-dialog .bc-order-table th:nth-child(1) { width: 4%; }
.bc-dialog .bc-order-table th:nth-child(2) { width: 38%; }
.bc-dialog .bc-order-table th:nth-child(3) { width: 12%; }
.bc-dialog .bc-order-table th:nth-child(4) { width: 13%; }
.bc-dialog .bc-order-table th:nth-child(5) { width: 17%; }
.bc-dialog .bc-order-table th:nth-child(6) { width: 16%; }
.bc-dialog .bc-order-table td {
  padding: 16px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--bc-line);
  overflow-wrap: anywhere;
}
.bc-dialog .bc-order-table th:first-child,
.bc-dialog .bc-order-table td:first-child { padding-left: 0; }
.bc-dialog .bc-order-table th:last-child,
.bc-dialog .bc-order-table td:last-child { padding-right: 0; }
.bc-dialog .bc-order-row.is-editing td {
  border-top: 1px solid var(--bc-gold);
  border-bottom-color: var(--bc-gold);
  background: #c2a76a0b;
}
.bc-dialog .bc-order-row.is-editing td:first-child { box-shadow: -2px 0 var(--bc-gold); }
.bc-dialog .bc-order-row.is-editing td:last-child { box-shadow: 2px 0 var(--bc-gold); }
.bc-dialog .bc-order-name { display: block; font-weight: 500; }
.bc-dialog .bc-order-name strong { font-weight: 500; }
.bc-dialog .bc-order-spec,
.bc-dialog .bc-order-services,
.bc-dialog .bc-order-unit-weight {
  display: block;
  margin-top: 5px;
  color: var(--bc-muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
}
.bc-dialog .bc-order-services { color: var(--bc-gold); }
.bc-dialog .bc-order-table td > strong { font-weight: 500; }
.bc-dialog .bc-order-qty {
  box-sizing: border-box;
  display: block;
  width: 76px;
  max-width: 100%;
  min-height: 38px;
  padding: 6px 7px;
  border: 1px solid var(--bc-line);
  border-radius: 0;
  background: var(--bc-bg);
  color: var(--bc-ink);
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.bc-dialog .bc-order-qty:focus { border-color: var(--bc-gold); }
.bc-dialog .bc-order-actions button,
.bc-dialog .bc-order-cancel {
  display: inline-block;
  min-height: 34px;
  max-width: 100%;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bc-ink);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #ffffff66;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.bc-dialog .bc-order-actions button { display: block; }
.bc-dialog .bc-order-actions button:last-child { color: var(--bc-muted); }
.bc-dialog .bc-order-actions button:hover,
.bc-dialog .bc-order-cancel:hover { color: var(--bc-gold); text-decoration-color: currentColor; }
.bc-dialog .bc-order-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 16px 24px;
  margin-top: 18px;
  padding: 18px 20px;
  background: #ffffff07;
  border: 1px solid var(--bc-line);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.bc-dialog .bc-order-total-count { color: var(--bc-muted); }
.bc-dialog .bc-order-total-length,
.bc-dialog .bc-order-total-mass { font-variant-numeric: tabular-nums; }
.bc-dialog .bc-order-total-mass { color: var(--bc-gold); font-size: 18px; font-weight: 500; }
.bc-dialog .bc-order-total strong { font-weight: 500; }
.bc-dialog .bc-order-note {
  margin-top: 12px;
  color: var(--bc-muted);
  font-size: 12px;
  line-height: 1.6;
}
.bc-dialog .bc-order-status {
  margin-top: 8px;
  color: var(--bc-gold);
  font-size: 13px;
  line-height: 1.5;
}
.bc-dialog .bc-order-status:empty { margin: 0; }
.bc-dialog .bc-order-quote { margin-top: 16px; max-width: 100%; white-space: normal; height: auto; min-height: 44px; }
.bc-dialog .bc-order-qty-error { display: block; margin-top: 5px; color: #ffb5a5; font-size: 11px; line-height: 1.4; }
.bc-dialog .bc-order-qty-error:empty { display: none; }
.bc-dialog .bc-order-qty[aria-invalid="true"] { border-color: #ffb5a5; }
.bc-dialog .bc-order-qty:disabled { opacity: .55; }
.bc-dialog .bc-order-add.bc-button { margin-top: 16px; max-width: 100%; white-space: normal; height: auto; min-height: 44px; }
.bc-dialog .bc-order-cancel { margin: 8px 0 0 14px; font-size: 13px; }
.bc-dialog .bc-draft-state { margin-top: 10px; color: var(--bc-gold); font-size: 12px; line-height: 1.5; }
.bc-dialog .bc-order button:focus-visible,
.bc-dialog .bc-order-qty:focus-visible,
.bc-dialog .bc-order-cancel:focus-visible { outline: 2px solid var(--bc-gold); outline-offset: 3px; }

@media (max-width: 1000px) and (min-width: 761px) {
  .bc-dialog .bc-order-table th,
  .bc-dialog .bc-order-table td { padding-left: 7px; padding-right: 7px; }
  .bc-dialog .bc-order-table th:nth-child(2) { width: 33%; }
  .bc-dialog .bc-order-table th:nth-child(6) { width: 21%; }
  .bc-dialog .bc-order-total { gap: 12px; padding: 16px; }
}

@media (max-width: 760px) {
  .bc-dialog .bc-order { margin: 8px 18px 24px; padding-top: 21px; }
  .bc-dialog .bc-order-head { gap: 10px; margin-bottom: 14px; }
  .bc-dialog .bc-order-head h3 { font-size: 22px; }
  .bc-dialog .bc-order-new { flex-basis: 100%; margin: 2px 0 0; text-align: center; min-height: 42px; }
  .bc-dialog .bc-order-empty { padding: 15px; font-size: 13px; }
  .bc-dialog .bc-order-table,
  .bc-dialog .bc-order-table tbody { display: block; width: 100%; }
  .bc-dialog .bc-order-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .bc-dialog .bc-order-table tbody { display: grid; gap: 12px; }
  .bc-dialog .bc-order-table .bc-order-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 16px;
    padding: 16px;
    border: 1px solid var(--bc-line);
    min-width: 0;
  }
  .bc-dialog .bc-order-table .bc-order-row.is-editing { border-color: var(--bc-gold); background: #c2a76a0b; }
  .bc-dialog .bc-order-table .bc-order-row td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .bc-dialog .bc-order-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--bc-muted);
    font-size: 11px;
    font-weight: 400;
  }
  .bc-dialog .bc-order-table td:nth-child(1),
  .bc-dialog .bc-order-table td:nth-child(2),
  .bc-dialog .bc-order-table td:nth-child(5),
  .bc-dialog .bc-order-table td.bc-order-actions { grid-column: 1 / -1; }
  .bc-dialog .bc-order-table td:nth-child(1) { color: var(--bc-gold); font-size: 12px; }
  .bc-dialog .bc-order-table td:nth-child(1)::before { display: inline; margin-right: 5px; color: var(--bc-gold); }
  .bc-dialog .bc-order-table td:nth-child(2)::before,
  .bc-dialog .bc-order-table td.bc-order-actions::before { display: none; }
  .bc-dialog .bc-order-name { font-size: 15px; }
  .bc-dialog .bc-order-spec,
  .bc-dialog .bc-order-services,
  .bc-dialog .bc-order-unit-weight { font-size: 12px; }
  .bc-dialog .bc-order-qty { width: 88px; min-height: 40px; font-size: 16px; }
  .bc-dialog .bc-order-table td.bc-order-actions { display: flex; flex-wrap: wrap; gap: 8px 24px; border-top: 1px solid #ffffff1c; padding-top: 6px; }
  .bc-dialog .bc-order-actions button { font-size: 13px; }
  .bc-dialog .bc-order-total { grid-template-columns: minmax(0, 1fr); gap: 9px; padding: 16px; margin-top: 14px; }
  .bc-dialog .bc-order-total-mass { font-size: 20px; }
  .bc-dialog .bc-order-add.bc-button { width: 100%; }
  .bc-dialog .bc-order-cancel { display: block; margin: 6px auto 0; text-align: center; }
}

@media (max-width: 350px) {
  .bc-dialog .bc-order { margin-right: 14px; margin-left: 14px; }
  .bc-dialog .bc-order-table .bc-order-row { padding: 13px; gap: 12px; }
  .bc-dialog .bc-order-total { padding: 13px; }
}
/* Let the two custom fields share label, input and error rows. */
#bc-dialog .bc-quantity-field .bc-input-wrap{width:min(100%,7rem)}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]{
  display:grid;
  grid-template-columns:minmax(0,1fr) 112px;
  column-gap:12px;
}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]> :is([data-custom-beam-name],.bc-quantity-field){display:contents}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>[data-custom-beam-name]>*{grid-column:1;min-width:0}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>.bc-quantity-field>*{grid-column:2;min-width:0}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]> :is([data-custom-beam-name],.bc-quantity-field)>label{
  display:block;
  grid-row:1;
  align-self:end;
  overflow-wrap:anywhere;
}
#bc-dialog [data-custom-beam-name]>label>span{font-size:11px;white-space:normal}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]> :is([data-custom-beam-name],.bc-quantity-field)>.bc-input-wrap{grid-row:2}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]> :is([data-custom-beam-name],.bc-quantity-field)>.bc-error{grid-row:3}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]> :is([data-custom-beam-name],.bc-quantity-field)>.bc-input-wrap>input{
  background:var(--bc-bg);
  font-size:16px;
}
#bc-dialog [data-custom-beam-name] .bc-input-wrap>input{padding-right:12px}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>.bc-quantity-field>.bc-input-wrap{width:min(100%,88px)}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>.bc-quantity-field>.bc-input-wrap>input{padding-left:8px;padding-right:24px}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>.bc-quantity-field>.bc-input-wrap>span{right:6px;top:50%;transform:translateY(-50%)}
#bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]>.bc-fabrication-fields{grid-column:1/-1;margin-top:15px}
@media(max-width:350px){
  #bc-dialog .bc-purchase-fields[data-purchase-mode="custom"]{grid-template-columns:minmax(0,1fr) 100px;column-gap:10px}
}
#bc-dialog .bc-owner-material{margin-top:16px;border:1px solid var(--bc-line);background:#353431}
#bc-dialog .bc-owner-material>summary{padding:11px 14px;cursor:pointer;color:var(--bc-ink);font-weight:650}
#bc-dialog .bc-owner-material>summary::marker{color:var(--bc-gold)}
#bc-dialog .bc-owner-body{display:grid;gap:11px;padding:0 14px 14px}
#bc-dialog .bc-owner-hint,#bc-dialog .bc-owner-error{margin:0;font-size:13px}
#bc-dialog .bc-owner-hint{color:var(--bc-muted)}
#bc-dialog .bc-owner-error{color:#ffc3ae}
#bc-dialog .bc-owner-formats{display:grid;gap:10px}
#bc-dialog .bc-owner-row{display:grid;grid-template-columns:minmax(0,1.2fr) repeat(2,minmax(0,1fr)) minmax(5.5rem,.5fr) auto;gap:8px;align-items:end;border:1px solid var(--bc-line);min-width:0;margin:0;padding:9px 10px 10px}
#bc-dialog .bc-owner-row:has([data-owner-grade]:not([hidden])){grid-template-columns:minmax(0,1.2fr) repeat(2,minmax(0,1fr)) minmax(5.5rem,.5fr) minmax(6rem,.8fr) auto}
#bc-dialog .bc-owner-row>legend{color:var(--bc-muted);padding:0 4px;font-size:12px}
#bc-dialog .bc-owner-row label{display:grid;gap:4px;font-size:12px;min-width:0}
#bc-dialog .bc-owner-row label[hidden]{display:none}
#bc-dialog .bc-owner-row input,#bc-dialog .bc-owner-row select{box-sizing:border-box;width:100%;min-width:0;min-height:44px;padding:5px 8px;border:1px solid var(--bc-line);background:#2b2a28;color:var(--bc-ink);font:inherit}
#bc-dialog .bc-owner-row [aria-invalid=true]{border-color:#ffc3ae}
#bc-dialog .bc-owner-add,#bc-dialog .bc-owner-remove{justify-self:start;min-height:44px;padding:5px 10px;border:1px solid var(--bc-line);background:transparent;color:var(--bc-ink);cursor:pointer;font:inherit}
#bc-dialog .bc-owner-add:disabled{opacity:.5;cursor:default}
#bc-dialog .bc-owner-material :is(input,select,button,summary):focus-visible{outline:2px solid var(--bc-gold);outline-offset:2px}
#bc-dialog :is(.bc-order-name,#bc-request-summary){overflow-wrap:anywhere}
@media(max-width:680px){
  #bc-dialog .bc-owner-row,#bc-dialog .bc-owner-row:has([data-owner-grade]:not([hidden])){grid-template-columns:repeat(2,minmax(0,1fr))}
}
