.box-dieline-template-panel {
  min-width: 0;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
}

.box-dieline-template-panel[hidden] {
  display: none !important;
}

/* Keep the two carton choices distinguishable when the longer name is selected. */
#spec-box[data-box-template="tuck-reverse"] > .row > .field:has(#bx-subtype) {
  grid-column: span 2 !important;
}

.box-dieline-template-head,
.box-dieline-template-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.box-dieline-template-title {
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 700;
}

.box-dieline-template-badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: rgba(59, 130, 246, .1);
  font-size: 10px;
  font-weight: 700;
}

.box-dieline-template-copy {
  margin-top: 1px;
  color: var(--color-text-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.box-dieline-template-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
}

.box-dieline-template-fields[hidden] {
  display: none !important;
}

.box-dieline-inline-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px;
  min-width: 0;
  margin: 0;
}

.box-dieline-inline-field span {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.box-dieline-inline-field input {
  width: 100%;
  min-width: 0;
  height: 27px;
  padding-right: 3px;
  padding-left: 5px;
}

.box-dieline-ratio-warning {
  overflow: hidden;
  margin-top: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 5px;
  background: rgba(255, 251, 235, .92);
  color: #b45309;
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.box-dieline-ratio-warning[hidden] {
  display: none !important;
}

.box-layout-dieline-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 10px;
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 1px solid rgba(59, 130, 246, .2);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(239, 246, 255, .96), rgba(255, 255, 255, .96));
  color: #334155;
  font-size: 10px;
}

.box-layout-dieline-main,
.box-layout-dieline-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.box-layout-dieline-main {
  flex-wrap: wrap;
}

.box-layout-dieline-name {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
}

.box-layout-dieline-spec {
  white-space: nowrap;
  color: #475569;
}

.box-layout-dieline-tools {
  justify-content: flex-end;
  white-space: nowrap;
}

.box-layout-layer {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.box-layout-layer i {
  display: inline-block;
  width: 17px;
  border-top: 2px solid #d40000;
}

.box-layout-layer.crease i {
  border-top-color: #0057d8;
  border-top-style: dashed;
}

.box-layout-mixed-note {
  color: #64748b;
}

.box-layout-dieline-tools button {
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid rgba(59, 130, 246, .25);
  border-radius: 5px;
  color: #1d4ed8;
  background: rgba(255, 255, 255, .88);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.box-layout-dieline-safety {
  grid-column: 1 / -1;
  color: #b45309;
  font-size: 9px;
}

.box-layout-dieline-warning {
  grid-column: 1 / -1;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(255, 247, 237, .95);
  color: #c2410c;
  font-size: 9px;
  line-height: 1.45;
}

.box-dieline-template-note {
  align-self: center;
  color: #b45309;
  font-size: 10px;
  line-height: 1.55;
}

.box-dieline-template-summary {
  align-items: flex-start;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(100, 116, 139, .24);
}

.box-dieline-template-derived {
  color: var(--color-text-secondary);
  font-size: 10px;
  line-height: 1.6;
}

.box-dieline-template-warning {
  color: #c2410c;
  font-size: 10px;
  line-height: 1.55;
}

.box-dieline-template-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.box-dieline-template-actions button {
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid rgba(59, 130, 246, .25);
  border-radius: 6px;
  color: #1d4ed8;
  background: rgba(255, 255, 255, .78);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.box-dieline-template-preview {
  min-height: 150px;
  max-height: 280px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid rgba(100, 116, 139, .18);
  border-radius: 8px;
  background: #fff;
}

.box-dieline-template-preview svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 150px;
  max-height: 270px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.box-dieline-template-legend {
  display: flex;
  gap: 14px;
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 10px;
}

.box-dieline-template-legend i {
  display: inline-block;
  width: 20px;
  margin-right: 4px;
  vertical-align: middle;
  border-top: 2px solid #d40000;
}

.box-dieline-template-legend .crease {
  border-top-color: #0057d8;
  border-top-style: dashed;
}

@media (max-width: 900px) {
  .box-dieline-template-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .box-dieline-template-note {
    grid-column: 1 / -1;
  }

  .box-dieline-template-summary {
    display: block;
  }

  .box-dieline-template-actions {
    margin-top: 7px;
  }

  .box-layout-dieline-caption {
    display: block;
  }

  .box-layout-dieline-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 5px;
  }

  .box-layout-dieline-safety {
    margin-top: 4px;
  }
}
