/* Owned form controls: one outer height per density, independent of native
   select metrics or legacy padding. Tables, review rows and toolbars retain
   their own density; multiline inputs and third-party widgets are excluded. */
.bf-enabled {
  --control-height: 40px;
}
/* bf-stack wraps both the caption and editor. The shared caption margin must
   not become an extra margin beneath the editor beside an action button. */
.bf-enabled label.bf-stack {
  margin-bottom: 0 !important;
}
.bf-enabled .eb-search {
  --control-height: 36px;
  align-items: end;
}
.bf-enabled :is(.ux-toolbar,.ux-upload-search,.wb-toolbar,.wb-filters,.rna-filters,.gp-filters,.pe-toolbar,.pe-filters,.fp-tools,.tb-toolbar) {
  --control-height: 36px;
}
.bf-enabled :is(table,.bf-compact) {
  --control-height: 32px;
}
.bf-enabled .bf-compact-review {
  --control-height: 30px;
}
.bf-enabled .bf-compact-review .auto-compare-row {
  --control-height: 32px;
}
.bf-enabled :is(.rna-setting-grid,.ux-demo-controls,.ux-composer-fields,.tb-fields,.wb-fields,dialog) {
  --control-height: 40px;
}
.bf-enabled :is(.rna-filters,.gp-filters,.fp-tools,.wb-toolbar,.tb-toolbar,.pe-toolbar) {
  --control-height: 36px;
}
.bf-enabled :is(
  input.bf-input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=color]),
  select.bf-input:not([multiple]):not([size]),
  select.bf-input[size="1"]
) {
  box-sizing: border-box !important;
  height: var(--control-height) !important;
  min-height: var(--control-height) !important;
  padding-block: calc((var(--control-height) - 22px) / 2) !important;
  line-height: 20px !important;
  margin-block: 0 !important;
  vertical-align: middle;
}
.bf-enabled :is(button,a.ux-button,a.wb-button,a.btn):not(:where(
  nav button,[role=tab],[role=tablist] button,
  .wb-steps button,.ux-entry-modes button,.gp-databases button,
  .site-language-switch button,.site-language-option,
  .wb-global-header button,.workspace-badge,
  .bf-help,.cr-section-reset,.cr-reset,.cr-fixed-details,
  .ux-file-clear,table button,
  [class*="igv-"] button,[data-third-party-form] button,
  .igv-container button,.igv-root-div button,.plotly button,
  .js-plotly-plot button,.select2-container button
)) {
  box-sizing: border-box;
  min-height: var(--control-height) !important;
  padding-block: calc((var(--control-height) - 22px) / 2) !important;
  line-height: 20px !important;
  margin-block: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Remove only row-ending label margins. The row gap supplies the spacing. */
.bf-enabled :is(
  .form-row,.ux-demo-controls,.ux-toolbar,.ux-upload-search,
  .wb-toolbar,.wb-fields,.wb-filters,.rna-context,.rna-filters,
  .rna-setting-grid,.gp-filters,.pe-toolbar,.pe-filters,
  .tb-toolbar,.tb-fields,.fp-tools
) {
  align-items: end;
}
.bf-enabled :is(
  .form-row,.ux-demo-controls,.ux-toolbar,.ux-upload-search,
  .wb-toolbar,.wb-fields,.wb-filters,.rna-context,.rna-filters,
  .rna-setting-grid,.gp-filters,.pe-toolbar,.pe-filters,
  .tb-toolbar,.tb-fields,.fp-tools
) > :is(label,.form-group,.ux-field,.wb-field,.rna-field) {
  margin-block: 0 !important;
}
.bf-enabled :is(
  .ux-demo-controls,.ux-toolbar,.ux-upload-search,.wb-toolbar,
  .rna-filters,.gp-filters,.pe-toolbar,.pe-filters,.tb-toolbar,.fp-tools
) > :is(button,a.ux-button,a.wb-button,a.btn) {
  align-self: end;
  white-space: nowrap;
}
.bf-enabled .ux-composer-fields :is(.grid-2,.grid-3) {
  align-items: end;
}
.bf-enabled .ux-composer-fields .form-group {
  margin-bottom: 0;
}
/* The compact comparison row uses the same 32px for its three selects and
   remove action. Parameter editors stay 30px and the submit bar stays 36px. */
.bf-enabled .bf-compact-review .auto-compare-row > button {
  height: 32px;
  min-height: 32px !important;
  padding-block: 5px !important;
}
.bf-enabled .cr-submit-actions {
  --control-height: 36px;
}
.bf-enabled .cr-changes {
  --control-height: 28px;
}
.bf-enabled .ux-file-slot-actions {
  --control-height: 30px;
}
.bf-enabled .gp-member-filters {
  --control-height: 36px;
  align-items: end;
}
.bf-enabled .gp-member-filters > label.bf-stack {
  margin-block: 0 !important;
}
.bf-enabled .gp-member-filters > button {
  align-self: end;
}
/* Download menus use summary elements styled as buttons. They participate in
   the same row geometry as the adjacent submit button and select controls. */
.bf-enabled :is(.gp-downloads,.rna-more) {
  margin-block: 0 !important;
}
.bf-enabled :is(.gp-downloads,.rna-more) > summary {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  min-height: var(--control-height);
  padding-block: calc((var(--control-height) - 22px) / 2);
  line-height: 20px;
  margin-block: 0;
  white-space: nowrap;
}
.bf-enabled .gp-downloads > div {
  top: calc(100% + 6px);
}
/* The native file-picker button has its own intrinsic line box. Size the
   picker and its outer field separately so Excel import rows also align. */
.bf-enabled input[type=file].bf-input {
  box-sizing: border-box;
  height: var(--control-height) !important;
  min-height: var(--control-height) !important;
  padding: 4px 8px !important;
  line-height: calc(var(--control-height) - 10px);
  margin-block: 0;
}
.bf-enabled input[type=file].bf-input::file-selector-button {
  box-sizing: border-box;
  height: calc(var(--control-height) - 10px);
  margin: 0 10px 0 0;
  padding: 0 9px;
  border: 1px solid #b8c4d5;
  border-radius: 3px;
  background: #f3f6fa;
  color: inherit;
  font: inherit;
  line-height: calc(var(--control-height) - 12px);
  cursor: pointer;
}
/* Keep checkbox/radio options, icons and growing text areas at their existing
   sizes. Do not turn the TF motif listbox into a one-line dropdown. */
.bf-enabled .tb-selector select,
.bf-enabled select[multiple],
.bf-enabled select[size]:not([size="1"]) {
  line-height: normal;
}
