@layer compras-compact-capture {
  /* Keep the folio and badges in their own layout area, before the stage actions. */
  #root .app-shell .dossier-shell > .dossier-header.dossier-header--folios > .dossier-header__identity {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  #root .app-shell .dossier-shell > .dossier-header.dossier-header--folios > .dossier-header__identity > div {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    min-width: 0;
    gap: 6px 8px !important;
  }

  #root .app-shell .dossier-shell > .dossier-header.dossier-header--folios > .dossier-header__identity h1 {
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  @media (min-width: 768px) {
    #root .app-shell:not(.app-shell--mobile) .dossier-shell > .dossier-header.dossier-header--folios:has(.rq-document-actions):not([data-aligned-stage]) {
      display: flex !important;
      flex-flow: row wrap !important;
      align-items: center !important;
      justify-content: flex-start !important;
      column-gap: 12px !important;
      row-gap: 8px !important;
      height: auto !important;
      max-height: none !important;
    }

    #root .app-shell:not(.app-shell--mobile) .dossier-shell > .dossier-header.dossier-header--folios:has(.rq-document-actions):not([data-aligned-stage]) > .dossier-header__identity {
      flex: 0 0 auto !important;
      width: max-content !important;
      margin: 0 !important;
    }

    #root .app-shell:not(.app-shell--mobile) .dossier-shell > .dossier-header.dossier-header--folios:has(.rq-document-actions):not([data-aligned-stage]) > .mobile-disclosure--stage-actions {
      flex: 0 1 auto !important;
      min-width: 0 !important;
      max-width: 100% !important;
      margin-inline-start: auto !important;
    }

    #root .app-shell:not(.app-shell--mobile) .dossier-shell > .dossier-header.dossier-header--folios:has(.rq-document-actions):not([data-aligned-stage]) :is(.dossier-header-controls, .dossier-header-actions, .rq-document-actions, .lifecycle-header-buttons) {
      flex: 0 1 auto !important;
      flex-wrap: wrap !important;
      width: auto !important;
      min-width: 0 !important;
      max-width: 100% !important;
      height: auto !important;
      align-items: center !important;
      justify-content: flex-end !important;
      gap: 6px !important;
    }

    #root .app-shell:not(.app-shell--mobile) .dossier-shell > .dossier-header.dossier-header--folios:has(.rq-document-actions):not([data-aligned-stage]) :is(.dossier-header-actions, .rq-document-actions) > :is(.button, .icon-button) {
      flex: 0 0 auto !important;
    }
  }
}
