.meta-sidebar__trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  height: auto !important;
  padding: 6px 12px !important;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
}

.meta-sidebar__trigger:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Show the label text (Gin hides it by default via visually-hidden) */
.meta-sidebar__trigger .caledon-sidebar-label {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: nowrap !important;
  font-size: 13px;
  font-weight: 500;
}

/* Keep the original visually-hidden span hidden (avoid duplicate text) */
.meta-sidebar__trigger > .visually-hidden {
  display: none !important;
}

/*
 * Block-content forms have no useful Gin metadata sidebar. Gin still reserves
 * its width, leaving an empty panel at the right of the editor. Limit this to
 * forms marked by caledon_sidebar_style_form_alter() so normal edit pages keep
 * their existing sidebar and layout.
 */
@media (min-width: 64em) {
  body:has(form.caledon-block-content-form) {
    --gin-sidebar-offset: 0px !important;
    padding-inline-end: 0 !important;
  }

  body:has(form.caledon-block-content-form) .layout-region-node-secondary,
  body:has(form.caledon-block-content-form) .meta-sidebar__trigger {
    display: none !important;
  }

  body:has(form.caledon-block-content-form) .page-wrapper__node-edit-form,
  body:has(form.caledon-block-content-form) .layout-region-node-main {
    max-width: none !important;
    width: 100% !important;
  }
}
